diff options
author | Peter Wu <peter@lekensteyn.nl> | 2020-06-14 22:59:19 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2020-06-14 22:59:19 +0200 |
commit | b68dc9af6db53de231d5ac71f9b6ba2ff3057a68 (patch) | |
tree | ff2b86b0a5e3093e3ffe5741e1cc65a33dd4dd28 /ltunify.c | |
parent | 872a781e07c079b880e36afd5b35504aabd5f7b1 (diff) | |
download | ltunify-master.tar.gz |
bInterfaceNumber is expected to return the `%02x` format according to
the current kernel sources. Even if that is not true, a user can always
manually specify the hidraw device if the wrong device is detected.
Diffstat (limited to 'ltunify.c')
-rw-r--r-- | ltunify.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1214,7 +1214,10 @@ int open_hidraw(void) { if (pid == PID_NANO_RECEIVER_2) { int iface = -1; if ((fp = fopen_format("/sys/class/hidraw/%s/device/../bInterfaceNumber", dev_name))) { - fscanf(fp, "%02x", &iface); + int m = fscanf(fp, "%02x", &iface); + if (m != 1) { + iface = -1; + } fclose(fp); } if (iface == 0) { |