|
|
View previous topic :: View next topic |
Author |
Message |
harshanahnd
Joined: 22 Nov 2008 Posts: 11
|
Problem on changing the display name of usb hid example code |
Posted: Sat Dec 13, 2008 11:11 am |
|
|
Hi,
I used ex_usb_hid.c example code to develop a usb hid device. I wanted to change the display string of it. ( The one which get shown when connected to the PC). After I change it the device wont get identified by the software that I have written but the PC does. Does anyone know how to change the following string correctly in the file usb_desc_hid.h,
Code: |
char USB_STRING_DESC_OFFSET[]={0,4,12};
char const USB_STRING_DESC[]={
//string 0
4, //length of string index
USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
0x09,0x04, //Microsoft Defined for US-English
//string 1
8, //length of string index
USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
'C',0,
'S',0,
'S',0,
//string 2
26, //length of string index
USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
'C',0,
'C',0,
'S',0,
' ',0,
'H',0,
'I',0,
'D',0,
' ',0,
'D',0,
'E',0,
'M',0,
'O',0
|
I want to change the "CCS HID DEMO" string to another different length string .
Thanks... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Dec 13, 2008 1:49 pm |
|
|
Post your modified version of the code that you posted. |
|
|
Guest
|
|
Posted: Sat Dec 13, 2008 9:32 pm |
|
|
Code: |
char USB_STRING_DESC_OFFSET[]={0,4,12};
char const USB_STRING_DESC[]={
//string 0
4, //length of string index
USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
0x09,0x04, //Microsoft Defined for US-English
//string 1
8, //length of string index
USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
'W',0,
'S',0,
'N',0,
//string 2
46, //length of string index
USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
'W',0,
'S',0,
'N',0,
' ',0,
'C',0,
'o',0,
'o',0,
'r',0,
'd',0,
'i',0,
'n',0,
'a',0,
't',0,
'o',0,
'r',0,
' ',0,
'b',0,
'y',0,
' ',0,
'C',0,
'S',0,
'E',0
|
And in the usb.h file , I have changed #DEFINE USB_DESC_INTERFACE_LEN 9 to 21.
Code: |
//The length of each descriptor
#DEFINE USB_DESC_DEVICE_LEN 18 //#DEFINE USB_DEVICE_DESC_LEN 18
#DEFINE USB_DESC_CONFIG_LEN 9 //#DEFINE USB_CONFIG_DESC_LEN 9
#DEFINE USB_DESC_INTERFACE_LEN 21 //#DEFINE USB_INTERFACE_DESC_LEN 9
#DEFINE USB_DESC_CLASS_LEN 9 //#DEFINE USB_CLASS_DESC_LEN 9
#DEFINE USB_DESC_ENDPOINT_LEN 7 //#DEFINE USB_ENDPOINT_DESC_LEN 7
|
Thats all I did .
Thanks... |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sun Dec 14, 2008 3:20 am |
|
|
Quote: | And in the usb.h file , I have changed #DEFINE USB_DESC_INTERFACE_LEN 9 to 21. |
That's wrong. You didn't change the interface descriptor length (it's fixed by specification) rather than a descriptor string length. The string length is coded correctly in the string list, as far as I see. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|