fix rndis response to get mac address
- remove cflags -fshort-enums - clean up webserver descriptor
This commit is contained in:
@@ -155,15 +155,16 @@ static uint16_t _desc_str[32];
|
|||||||
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
|
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
|
||||||
uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
||||||
{
|
{
|
||||||
(void)langid;
|
(void) langid;
|
||||||
|
|
||||||
unsigned chr_count = 0;
|
uint8_t chr_count = 0;
|
||||||
|
|
||||||
if (STR_LANGID == index)
|
if (STR_LANGID == index)
|
||||||
{
|
{
|
||||||
memcpy(&_desc_str[1], string_desc_arr[0], 2);
|
memcpy(&_desc_str[1], string_desc_arr[0], 2);
|
||||||
chr_count = 1;
|
chr_count = 1;
|
||||||
}
|
}
|
||||||
|
#if CFG_TUD_NET == OPT_NET_ECM
|
||||||
else if (STR_MAC == index)
|
else if (STR_MAC == index)
|
||||||
{
|
{
|
||||||
// Convert MAC address into UTF-16
|
// Convert MAC address into UTF-16
|
||||||
@@ -174,6 +175,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
_desc_str[1+chr_count++] = "0123456789ABCDEF"[(tud_network_mac_address[i] >> 0) & 0xf];
|
_desc_str[1+chr_count++] = "0123456789ABCDEF"[(tud_network_mac_address[i] >> 0) & 0xf];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Convert ASCII string into UTF-16
|
// Convert ASCII string into UTF-16
|
||||||
@@ -186,7 +188,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
|
|||||||
chr_count = strlen(str);
|
chr_count = strlen(str);
|
||||||
if ( chr_count > (TU_ARRAY_SIZE(_desc_str) - 1)) chr_count = TU_ARRAY_SIZE(_desc_str) - 1;
|
if ( chr_count > (TU_ARRAY_SIZE(_desc_str) - 1)) chr_count = TU_ARRAY_SIZE(_desc_str) - 1;
|
||||||
|
|
||||||
for (unsigned i=0; i<chr_count; i++)
|
for (uint8_t i=0; i<chr_count; i++)
|
||||||
{
|
{
|
||||||
_desc_str[1+i] = str[i];
|
_desc_str[1+i] = str[i];
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ INC += $(TOP)/src
|
|||||||
|
|
||||||
#
|
#
|
||||||
CFLAGS += $(addprefix -I,$(INC))
|
CFLAGS += $(addprefix -I,$(INC))
|
||||||
LDFLAGS += $(CFLAGS) -fshort-enums -Wl,-T,$(TOP)/$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nosys.specs -specs=nano.specs
|
LDFLAGS += $(CFLAGS) -Wl,-T,$(TOP)/$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nosys.specs -specs=nano.specs
|
||||||
ASFLAGS += $(CFLAGS)
|
ASFLAGS += $(CFLAGS)
|
||||||
|
|
||||||
# Assembly files can be name with upper case .S, convert it to .s
|
# Assembly files can be name with upper case .S, convert it to .s
|
||||||
|
@@ -120,8 +120,8 @@ static void rndis_query(void)
|
|||||||
{
|
{
|
||||||
case OID_GEN_SUPPORTED_LIST: rndis_query_cmplt(RNDIS_STATUS_SUCCESS, OIDSupportedList, 4 * OID_LIST_LENGTH); return;
|
case OID_GEN_SUPPORTED_LIST: rndis_query_cmplt(RNDIS_STATUS_SUCCESS, OIDSupportedList, 4 * OID_LIST_LENGTH); return;
|
||||||
case OID_GEN_VENDOR_DRIVER_VERSION: rndis_query_cmplt32(RNDIS_STATUS_SUCCESS, 0x00001000); return;
|
case OID_GEN_VENDOR_DRIVER_VERSION: rndis_query_cmplt32(RNDIS_STATUS_SUCCESS, 0x00001000); return;
|
||||||
case OID_802_3_CURRENT_ADDRESS: rndis_query_cmplt(RNDIS_STATUS_SUCCESS, &station_hwaddr, 6); return;
|
case OID_802_3_CURRENT_ADDRESS: rndis_query_cmplt(RNDIS_STATUS_SUCCESS, station_hwaddr, 6); return;
|
||||||
case OID_802_3_PERMANENT_ADDRESS: rndis_query_cmplt(RNDIS_STATUS_SUCCESS, &permanent_hwaddr, 6); return;
|
case OID_802_3_PERMANENT_ADDRESS: rndis_query_cmplt(RNDIS_STATUS_SUCCESS, permanent_hwaddr, 6); return;
|
||||||
case OID_GEN_MEDIA_SUPPORTED: rndis_query_cmplt32(RNDIS_STATUS_SUCCESS, NDIS_MEDIUM_802_3); return;
|
case OID_GEN_MEDIA_SUPPORTED: rndis_query_cmplt32(RNDIS_STATUS_SUCCESS, NDIS_MEDIUM_802_3); return;
|
||||||
case OID_GEN_MEDIA_IN_USE: rndis_query_cmplt32(RNDIS_STATUS_SUCCESS, NDIS_MEDIUM_802_3); return;
|
case OID_GEN_MEDIA_IN_USE: rndis_query_cmplt32(RNDIS_STATUS_SUCCESS, NDIS_MEDIUM_802_3); return;
|
||||||
case OID_GEN_PHYSICAL_MEDIUM: rndis_query_cmplt32(RNDIS_STATUS_SUCCESS, NDIS_MEDIUM_802_3); return;
|
case OID_GEN_PHYSICAL_MEDIUM: rndis_query_cmplt32(RNDIS_STATUS_SUCCESS, NDIS_MEDIUM_802_3); return;
|
||||||
|
Reference in New Issue
Block a user