File tree 2 files changed +8
-3
lines changed
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ static u8 modules_count = 0;
35
35
36
36
static PUSBListNode* rootNode = NULL ;
37
37
38
- char _iSerialNum[2 *MAX_MODULES] = {0 };
38
+ static char _iSerialNum[5 *MAX_MODULES] = {0 };
39
39
40
40
int PUSB_GetInterface (u8* interfaceNum)
41
41
{
@@ -62,10 +62,11 @@ int PUSB_GetDescriptor(int8_t t)
62
62
char * PUSB_GetShortName ()
63
63
{
64
64
char * ret = 0 ;
65
+ memset (_iSerialNum, 0 , sizeof (_iSerialNum));
65
66
PUSBListNode* node = rootNode;
66
67
for (u8 i=0 ; i<modules_count; i++) {
67
68
ret = node->cb ->getShortName ();
68
- memcpy (&_iSerialNum[i* 2 ], ret, 2 );
69
+ memcpy (&_iSerialNum[strlen (_iSerialNum) ], ret, strlen (ret) );
69
70
node = node->next ;
70
71
}
71
72
return _iSerialNum;
Original file line number Diff line number Diff line change @@ -81,7 +81,11 @@ int HID_GetDescriptor(int8_t t)
81
81
82
82
char * HID_GetShortName ()
83
83
{
84
- static char * name = " HI" ;
84
+ static char name[5 ];
85
+ char num[3 ];
86
+ memcpy (name, " HI" , 2 );
87
+ itoa (sizeof_hidReportDescriptor, num, 10 );
88
+ memcpy (&name[2 ], num, 3 );
85
89
return name;
86
90
}
87
91
You can’t perform that action at this time.
0 commit comments