Go to the source code of this file.
int cmd_fwupdate |
( |
usbdevice * |
kb, |
|
|
usbmode * |
dummy1, |
|
|
int |
nnumber, |
|
|
int |
dummy2, |
|
|
const char * |
path |
|
) |
| |
Definition at line 154 of file firmware.c.
References FEAT_FWUPDATE, FW_NOFILE, FW_OK, FW_USBFAIL, FW_WRONGDEV, fwupdate(), HAS_FEATURES, nprintf(), and usb_tryreset().
161 int ret =
fwupdate(kb, path, nnumber);
170 nprintf(kb, nnumber, 0,
"fwupdate %s ok\n", path);
174 nprintf(kb, nnumber, 0,
"fwupdate %s invalid\n", path);
177 nprintf(kb, nnumber, 0,
"fwupdate %s fail\n", path);
void nprintf(usbdevice *kb, int nodenumber, usbmode *mode, const char *format,...)
int usb_tryreset(usbdevice *kb)
#define HAS_FEATURES(kb, feat)
int fwupdate(usbdevice *kb, const char *path, int nnumber)
Definition at line 11 of file firmware.c.
References ckb_err, ckb_warn, FEAT_POLLRATE, usbdevice::features, usbdevice::fwversion, MSG_SIZE, usbdevice::pollrate, usbdevice::product, usbrecv, and usbdevice::vendor.
Referenced by _start_dev().
15 if(!
usbrecv(kb, data_pkt, in_pkt))
17 if(in_pkt[0] != 0x0e || in_pkt[1] != 0x01){
21 short vendor, product, version, bootloader;
23 memcpy(&version, in_pkt + 8, 2);
24 memcpy(&bootloader, in_pkt + 10, 2);
25 memcpy(&vendor, in_pkt + 12, 2);
26 memcpy(&product, in_pkt + 14, 2);
27 char poll = in_pkt[16];
34 ckb_warn(
"Got vendor ID %04x (expected %04x)\n", vendor, kb->
vendor);
36 ckb_warn(
"Got product ID %04x (expected %04x)\n", product, kb->
product);
38 if(version == 0 || bootloader == 0){
#define ckb_err(fmt, args...)
#define ckb_warn(fmt, args...)
#define usbrecv(kb, out_msg, in_msg)
usbrecv macro is used to wrap _usbrecv() with debugging information (file and lineno) ...