Dynamic Serial Number at runtime
Posted: Wed Feb 25, 2009 8:19 pm
I have spent quite some time trying to implement a dynamic serial number or device id or any other method of being able to select any one of several identical usb devices without success
The Idea is to have several identical devices eg powerswitches, running identical firmware but be individually addressable by means of setting the serial number or device ID at runtime (or even at boot time) via jumper or dipswitch.
I understand that you must define in usbconfig.h:
and also implement in main.c:
Does anyone have any working example or information on how to do this ?
Thanks.
The Idea is to have several identical devices eg powerswitches, running identical firmware but be individually addressable by means of setting the serial number or device ID at runtime (or even at boot time) via jumper or dipswitch.
I understand that you must define in usbconfig.h:
Code: Select all
#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER USB_PROP_IS_DYNAMIC
and also implement in main.c:
Code: Select all
uchar usbFunctionDescriptor(usbRequest_t *rq)
{
uchar *p = 0, len = 0;
if(rq->wValue.bytes[1] == ????????)
{
???????
}
usbMsgPtr = p;
return len;
}
Does anyone have any working example or information on how to do this ?
Thanks.