1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-05 04:55:19 +02:00

atrf-id.c (show_usb_info): pretty-print the MCU type for ATUSB boards

This commit is contained in:
Werner Almesberger 2011-02-10 23:43:36 -03:00
parent 19926ae32f
commit 1d6fbcbd21

View File

@ -76,6 +76,7 @@ static void show_usb_info(struct atrf_dsc *dsc)
usb_dev_handle *dev; usb_dev_handle *dev;
const struct usb_device *device; const struct usb_device *device;
uint8_t major, minor, target; uint8_t major, minor, target;
const char *mcu;
char buf[BUF_SIZE+1]; /* +1 for terminating \0 */ char buf[BUF_SIZE+1]; /* +1 for terminating \0 */
int len; int len;
@ -89,7 +90,18 @@ static void show_usb_info(struct atrf_dsc *dsc)
if (get_protocol(dev, &major, &minor, &target) < 0) if (get_protocol(dev, &major, &minor, &target) < 0)
exit(1); exit(1);
printf("protocol %u.%u hw %u\n", major, minor, target); switch (target) {
case HW_TYPE_100813:
case HW_TYPE_101216:
mcu = "C8051F326";
break;
case HW_TYPE_110131:
mcu = "ATmega32U2";
break;
default:
mcu = "???";
}
printf("protocol %u.%u hw %u (%s)\n", major, minor, target, mcu);
len = get_build(dev, buf, sizeof(buf)-1); len = get_build(dev, buf, sizeof(buf)-1);
if (len < 0) if (len < 0)