Hello,
I can't figure out an issue with my usb. My String Descriptors are not getting recognized anymore, and are displayed as follows:
$ ioreg -p IOUSB -w0 -l
+-o 躊̆遮㌲㔴㜶㤸䉁䑃䙅⠀畮汬瀠@14200000 <class AppleUSBDevice, id 0x1000160a6, registered, matched, active, busy 0 (15 ms), retain 21>
{
"sessionID" = 748745556024218
"iManufacturer" = 1
"bNumConfigurations" = 1
"idProduct" = 5812
"bcdDevice" = 256
"Bus Power Available" = 500
"USB Address" = 12
"bMaxPacketSize0" = 32
"iProduct" = 2
"iSerialNumber" = 3
"bDeviceClass" = 0
"Built-In" = No
"locationID" = 337641472
"bDeviceSubClass" = 0
"bcdUSB" = 512
"USB Product Name" =
"PortNum" = 2
"non-removable" = "no"
"IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
"bDeviceProtocol" = 0
"IOUserClientClass" = "IOUSBDeviceUserClientV2"
"IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
"Device Speed" = 1
"USB Vendor Name" =
"idVendor" = 1105
"IOGeneralInterest" = "IOCommand is not serializable"
"USB Serial Number" =
"IOClassNameOverride" = "IOUSBDevice"
}
I left the Device Descriptor and String Descriptors largely unchanged, which makes me question what I should be looking at...
usbDescStart:
deviceDesc: ; Device descriptor
DB deviceDescEnd - deviceDesc ; bLength
DB DESC_TYPE_DEVICE ; bDescriptorType
DW 0200H ; bcdUSB (USB 2.0)
DB 00H ; bDeviceClass (given by interface)
DB 00H ; bDeviceSubClass
DB 00H ; bDeviceProtocol
DB EP0_PACKET_SIZE
DW 0451H ; idVendor (Texas Instruments)
DW 16B4H ; idProduct (CC2540 HID)
DW 0100H ; bcdDevice (v1.0)
DB 01H ; iManufacturer
DB 02H ; iProduct
DB 03H ; iSerialNumber
DB 01H ; bNumConfigurations
deviceDescEnd:
;;-------------------------------------------------------------------------------------------------------
;; String descriptors
string0Desc: ; Language ID
DB string0DescEnd - string0Desc ; bLength
DB DESC_TYPE_STRING ; bDescriptorType
DW 0409H ; wLangID (English-US)
string0DescEnd:
string1Desc: ; Manufacturer
DB string1DescEnd - string1Desc ; bLength
DB DESC_TYPE_STRING ; bDescriptorType
DB 'T', 0 ; unicode string
DB 'e', 0
DB 'x', 0
DB 'a', 0
DB 's', 0
DB ' ', 0
DB 'I', 0
DB 'n', 0
DB 's', 0
DB 't', 0
DB 'r', 0
DB 'u', 0
DB 'm', 0
DB 'e', 0
DB 'n', 0
DB 't', 0
DB 's', 0
string1DescEnd:
string2Desc: ; Product
DB string2DescEnd - string2Desc ; bLength
DB DESC_TYPE_STRING ; bDescriptorType
DB 'H', 0
DB 'I', 0
DB 'D', 0
string2DescEnd:
; To enable multiple HID dongles to connect to a PC,
; program a unique serial number for each dongle.
string3Desc: ; Serial Number
DB string3DescEnd - string3Desc
DB DESC_TYPE_STRING ; bDescriptorType
DB '1', 0
DB '1', 0
DB '0', 0
string3DescEnd:
usbDescEnd:
What should I look at, to find the error?
I have changed usbsrGetDescriptors, but not for the Device Descriptors nor the String Descriptors.
void usbsrGetDescriptor(void)
{
uint8 n;
// Which descriptor?
switch (HI_UINT16(usbSetupHeader.value)) {
// Device descriptor
case DESC_TYPE_DEVICE:
usbSetupData.pBuffer = (uint8 __code*) usbdpGetDeviceDesc();
usbSetupData.bytesLeft = usbSetupData.pBuffer[DESC_LENGTH_IDX];
break;
// Configuration descriptor
case DESC_TYPE_CONFIG:
if(inMemoryConfig == NULL) {
inMemoryConfig = (uint8 __xdata *)getConfigurationDescriptor ();
}
/* This is where the magic happens! */
if(inMemoryConfig == NULL) {
usbSetupData.pBuffer = (uint8 __code*) usbdpGetConfigurationDesc(0, LO_UINT16(usbSetupHeader.value));
usbSetupData.bytesLeft = usbSetupData.pBuffer[DESC_CONFIG_LENGTH_LSB_IDX] +
usbSetupData.pBuffer[DESC_CONFIG_LENGTH_MSB_IDX] * 256;
} else {
usbSetupData.pBuffer = (uint8 __xdata *) inMemoryConfig;
//printf("mm: %x %x\n", inMemoryConfig[DESC_CONFIG_LENGTH_LSB_IDX],inMemoryConfig[DESC_CONFIG_LENGTH_MSB_IDX]);
//printf("pB: %x %x\n", usbSetupData.pBuffer[DESC_CONFIG_LENGTH_LSB_IDX],usbSetupData.pBuffer[DESC_CONFIG_LENGTH_MSB_IDX]);
usbSetupData.bytesLeft = usbSetupData.pBuffer[DESC_CONFIG_LENGTH_LSB_IDX] +
usbSetupData.pBuffer[DESC_CONFIG_LENGTH_MSB_IDX] * 256;
}
//printf("\n codeAr:");
//code_printArray(usbSetupData.bytesLeft, (uint8 __code * )usbdpGetConfigurationDesc(0, LO_UINT16(usbSetupHeader.value)));
//printf("\n myData:");
//generic_printArray(usbSetupData.bytesLeft, (uint8 __xdata *)inMemoryConfig);
//printf("\n");
//printf("cl: %d\n",usbSetupData.bytesLeft);
break;
// String descriptor
case DESC_TYPE_STRING:
// OPT: Implement language ID
usbSetupData.pBuffer = (uint8*) usbdpGetStringDesc(LO_UINT16(usbSetupHeader.value));
usbSetupData.bytesLeft = usbSetupData.pBuffer[DESC_LENGTH_IDX];
break;
// Other descriptor type
default:
//printf("%d\n", HI_UINT16(usbSetupHeader.value));
// Perform a table search (on index and value)
usbSetupData.pBuffer = NULL;
uint8 isDescriptorDefinedInMem = FALSE;
if(inMemDescriptorTable == NULL)
inMemDescriptorTable = getReportDescriptor();
if (inMemDescriptorTable != NULL &&
(inMemDescriptorTable->valueMsb == HI_UINT16(usbSetupHeader.value))
&& (inMemDescriptorTable->valueLsb == LO_UINT16(usbSetupHeader.value))
&& (inMemDescriptorTable->indexMsb == HI_UINT16(usbSetupHeader.index))
&& (inMemDescriptorTable->indexLsb == LO_UINT16(usbSetupHeader.index)) )
{
usbSetupData.pBuffer = (uint8 __generic *)inMemDescriptorTable->pDescStart;
usbSetupData.bytesLeft = inMemDescriptorTable->length;
isDescriptorDefinedInMem = TRUE;
//printf("w");
}
if(isDescriptorDefinedInMem == FALSE) {
for (n = 0; n < ((uint16)usbDescriptorMarker.pUsbDescLutEnd - (uint16)usbDescriptorMarker.pUsbDescLut) / sizeof(DESC_LUT_INFO); n++) {
if ((usbDescriptorMarker.pUsbDescLut[n].valueMsb == HI_UINT16(usbSetupHeader.value))
&& (usbDescriptorMarker.pUsbDescLut[n].valueLsb == LO_UINT16(usbSetupHeader.value))
&& (usbDescriptorMarker.pUsbDescLut[n].indexMsb == HI_UINT16(usbSetupHeader.index))
&& (usbDescriptorMarker.pUsbDescLut[n].indexLsb == LO_UINT16(usbSetupHeader.index)) )
{
usbSetupData.pBuffer = usbDescriptorMarker.pUsbDescLut[n].pDescStart;
usbSetupData.bytesLeft = usbDescriptorMarker.pUsbDescLut[n].length;
}
}
}
isDescriptorDefinedInMem = FALSE;
}
// Stall EP0 if no descriptor was found
if (usbSetupData.pBuffer == NULL) usbfwData.ep0Status = EP_STALL;
if (usbfwData.ep0Status != EP_STALL) {
// Limit the returned descriptor size (the PC wants to know about sizes before
// polling the complete descriptors)
if (usbSetupData.bytesLeft > usbSetupHeader.length) {
usbSetupData.bytesLeft = usbSetupHeader.length;
}
usbfwData.ep0Status = EP_TX;
}
} // usbsrGetDescriptor