diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2016-03-09 00:15:59 +0100 |
---|---|---|
committer | Pali Rohár <pali.rohar@gmail.com> | 2016-03-09 00:15:59 +0100 |
commit | c560f3642c20eeeabd882a671741ac7a3b087e02 (patch) | |
tree | da48d08a587557eae547aa21ab68a3ea9e648072 /src | |
parent | 98451c5851bbdeeac1fca0a2bbd57e75e346bd69 (diff) | |
download | 0xFFFF-c560f3642c20eeeabd882a671741ac7a3b087e02.tar.bz2 |
usb-device: Finish usb device detection based on product strings
Diffstat (limited to 'src')
-rw-r--r-- | src/usb-device.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/usb-device.c b/src/usb-device.c index 4b64fae..e0c4074 100644 --- a/src/usb-device.c +++ b/src/usb-device.c @@ -209,22 +209,37 @@ static struct usb_device_info * usb_device_is_valid(struct libusb_device * dev) return NULL; } - if ( strncmp(product, "Nokia 770", sizeof("Nokia 770")-1) == 0 ) + if ( strcmp(product, "Nokia 770") == 0 || strcmp(product, "Nokia 770 (Update mode)") == 0 ) ret->device = DEVICE_SU_18; - else if ( strstr(product, "N900") ) + else if ( strcmp(product, "Nokia N800 Internet Tablet") == 0 || strcmp(product, "Nokia N800 (Update mode)") == 0 ) + ret->device = DEVICE_RX_34; + else if ( strcmp(product, "Nokia N810 Internet Tablet") == 0 || strcmp(product, "Nokia N810 (Update mode)") == 0 ) + ret->device = DEVICE_RX_44; + else if ( strcmp(product, "Nokia N810 Internet Tablet WiMAX Edition") == 0 || strcmp(product, "Nokia-RX48 (Update mode)") == 0 ) + ret->device = DEVICE_RX_48; + else if ( strcmp(product, "N900 (Storage Mode)") == 0 || strcmp(product, "Nokia N900 (Update mode)") == 0 || strcmp(product, "N900 (PC-Suite Mode)") == 0 ) ret->device = DEVICE_RX_51; + else if ( strcmp(product, "Nokia USB ROM") == 0 ) + ret->device = DEVICE_ANY; else ret->device = DEVICE_UNKNOWN; - /* TODO: Autodetect more devices */ - if ( device_to_string(ret->device) ) PRINTF_LINE("Detected USB device: %s", device_to_string(ret->device)); else PRINTF_LINE("Detected USB device: (not detected)"); PRINTF_END(); - if ( ret->device ) { + if ( ! noverify && ret->device == DEVICE_UNKNOWN ) { + ERROR("Device detection failed"); + fprintf(stderr, "\n"); + usb_reattach_kernel_driver(udev, usb_devices[i].interface); + libusb_close(udev); + free(ret); + return NULL; + } + + if ( ! noverify && ret->device != DEVICE_ANY ) { enum device * device; for ( device = usb_devices[i].devices; *device; ++device ) if ( *device == ret->device ) |