diff options
Diffstat (limited to 'src/devices.c')
-rw-r--r-- | src/devices.c | 74 |
1 files changed, 40 insertions, 34 deletions
diff --git a/src/devices.c b/src/devices.c index 2691770..cb1e05d 100644 --- a/src/devices.c +++ b/src/devices.c @@ -1,6 +1,7 @@ /* * 0xFFFF - Open Free Fiasco Firmware Flasher - * Copyright (C) 2007 pancake <pancake@youterm.com> + * Copyright (C) 2007-2009 pancake <pancake@nopcode.org> + * Copyright (C) 2012 Pali Rohár <pali.rohar@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,18 +30,31 @@ * * The following table shows this info: * - * boot os - * n770 0421:0105 0421:0431 - * n800 0421:0431 + * omap-rom nolo flash-mode mass-stor pc-suite + * 770 0421:0105 0421:0431 + * n800 0421:04c3 0421:0431 + * n810 0421:0105 + * n900 0421:0106 0421:0105 0421:01c8 0421:01c7 0421:01c8 + * + * mode images protocol + * omap-rom 2nd, secondary OMAP messages + Nokia X-Loader protocol + * nolo all except mmc NOLO + * flash-mode mmc MK II + * mass-storage sd, first emmc Standard USB Mass Storage + * pc-suite mmc MK II * */ struct devices supported_devices[SUPPORTED_DEVICES] = { - { "FFFF", 0x000, 0x0000, 0x0000 }, // dummy - { "unkn", 0x421, 0x3f00, 0x0000 }, // probably a development board - { "n770/n810", 0x421, 0x0105, 0x0001 }, // my n770 - { "n800", 0x421, 0x04c3, 0x0001 }, // a n800 - { 0 }, - { 0 } + { "FFFF", 0x0000, 0x0000, FLASH_NORMAL }, // dummy + { "unkn", 0x0421, 0x3f00, FLASH_NORMAL }, // probably a development board + { "n800", 0x0421, 0x04c3, FLASH_NORMAL }, // n800 + { "770/n810/n900", 0x0421, 0x0105, FLASH_NORMAL }, // 770, n810, n900 + { "n900", 0x0421, 0x0106, FLASH_COLD }, // n900 cold flashing + { "n900", 0x0421, 0x01c8, FLASH_MKII }, // n900 mmc flashing + { "770/n800", 0x0421, 0x0431, FLASH_DISK }, // 770, n800 usb mass storage + { "n900", 0x0421, 0x01c7, FLASH_DISK }, // n900 usb mass storage + { NULL }, + { NULL } }; /** Returns 0 when no device was found and a positive @@ -73,7 +87,7 @@ void list_valid_devices() int i; struct devices ptr = supported_devices[1]; - for(i=1; ptr.vendor_id; ptr = supported_devices[++i]) + for(i=1; ptr.name; ptr = supported_devices[++i]) printf("%04x:%04x %s\n", ptr.vendor_id, ptr.product_id, ptr.name); } @@ -82,39 +96,31 @@ void list_valid_devices() * structures for the specified device. * Otherwise returns false (0) */ - int usb_device_found(struct usb_device_descriptor *udd, struct devices *it_device) { + int dev_index = 0; struct usb_bus *bus; - int dev_index = 0; - - if (usb_find_busses() < 0) { - fprintf(stderr, "\nerror: no usb busses found.\n"); + if ((usb_find_busses()<0) || (usb_find_devices()==-1)) { + fprintf(stderr, "\nerror: no usb bus or device found.\n"); exit(1); } else { - switch(usb_find_devices()) { - case -1: - fprintf(stderr, "\nerror: no devices found.\n"); - exit(1); - default: - for (bus = usb_busses; bus; bus = bus->next) { - struct usb_device *dev = bus->devices; - D printf("bus: \n"); - for (; dev; dev = dev->next) { - *udd = dev->descriptor; - D printf(" dev (%s) - ", dev->filename); - D printf("vendor: %04x product: %04x\n", udd->idVendor, udd->idProduct); + for (bus = usb_busses; bus; bus = bus->next) { + struct usb_device *dev = bus->devices; + D printf("bus: \n"); + for (; dev; dev = dev->next) { + *udd = dev->descriptor; + D printf(" dev (%s) - ", dev->filename); + D printf("vendor: %04x product: %04x\n", udd->idVendor, udd->idProduct); - if ((dev_index = is_valid_device(udd))) { - device = dev; - *it_device = supported_devices[dev_index]; - return 1; - } + if ((dev_index = is_valid_device(udd))) { + device = dev; + printf("%s found!\n", dev->filename); + *it_device = supported_devices[dev_index]; + return 1; } } } } - return 0; } #endif |