Skip to content

Commit 4bb4134

Browse files
FozzTexxtschak909
authored andcommitted
Print FujiNet firmware version during driver init.
1 parent a298c20 commit 4bb4134

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

fujicom/fujicom.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ typedef struct {
5959
char file[36];
6060
} deviceSlot_t;
6161

62+
// FIXME - get this from lib/device/sio/fuji.h
63+
#define MAX_SSID_LEN 32
64+
typedef struct {
65+
char ssid[MAX_SSID_LEN+1];
66+
char hostname[64];
67+
unsigned char localIP[4];
68+
unsigned char gateway[4];
69+
unsigned char netmask[4];
70+
unsigned char dnsIP[4];
71+
unsigned char macAddress[6];
72+
unsigned char bssid[6];
73+
char fn_version[15];
74+
} AdapterConfig;
75+
6276
#pragma pack(pop)
6377

6478
enum {
@@ -89,6 +103,7 @@ enum {
89103
CMD_APETIME_GETTIME = 0x93,
90104
CMD_APETIME_SETTZ = 0x99,
91105
CMD_APETIME_GETTZTIME = 0x9A,
106+
CMD_GET_ADAPTERCONFIG = 0xE8,
92107
CMD_READ_DEVICE_SLOTS = 0xF2,
93108
CMD_JSON = 0xFC,
94109
CMD_USERNAME = 0xFD,

sys/init.c

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ extern void setf5(void);
5353

5454
#pragma data_seg("_CODE")
5555

56+
uint8_t get_fujinet_version();
5657
uint8_t get_set_time(uint8_t set_flag);
5758
void check_uart();
5859
uint16_t parse_config(const uint8_t far *config_sys);
@@ -78,9 +79,11 @@ uint16_t Init_cmd(SYSREQ far *req)
7879
fujicom_init();
7980
check_uart();
8081

81-
err = get_set_time(!getenv("NOTIME"));
82+
err = get_fujinet_version();
83+
if (!err)
84+
err = get_set_time(!getenv("NOTIME"));
8285

83-
// If get_set_time returned error, FujiNet is probably not connected
86+
// If get_ returned error, FujiNet is probably not connected
8487
if (err) {
8588
fujicom_done();
8689
return ERROR_BIT;
@@ -121,6 +124,31 @@ uint16_t Init_cmd(SYSREQ far *req)
121124
return OP_COMPLETE;
122125
}
123126

127+
/* Returns non-zero on error */
128+
uint8_t get_fujinet_version()
129+
{
130+
char reply = 0;
131+
AdapterConfig config;
132+
unsigned int idx;
133+
134+
135+
cmd.device = DEVICEID_FUJINET;
136+
cmd.comnd = CMD_GET_ADAPTERCONFIG;
137+
reply = fujicom_command_read(&cmd, (uint8_t *) &config, sizeof(config));
138+
139+
if (reply != 'C') {
140+
consolef("Unable to get FujiNet version %i.\nAborted.\n", reply);
141+
return 1;
142+
}
143+
144+
consolef("FujiNet firmware version ");
145+
for (idx = 0; idx < sizeof(config.fn_version) && config.fn_version[idx]; idx++)
146+
printChar(config.fn_version[idx]);
147+
consolef("\n");
148+
149+
return 0;
150+
}
151+
124152
/* Returns non-zero on error */
125153
uint8_t get_set_time(uint8_t set_flag)
126154
{

0 commit comments

Comments
 (0)