summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2013-01-30 15:46:26 +0000
committerhselasky <hselasky@FreeBSD.org>2013-01-30 15:46:26 +0000
commit34829d74e1222ffb99ba5a0dc56d3a62c7813ca5 (patch)
tree7deb6aabb1fced511305bb7585dcf39efe030c3e
parent0fbe1630154e5d48b97c66259002053ea2c04768 (diff)
downloadFreeBSD-src-34829d74e1222ffb99ba5a0dc56d3a62c7813ca5.zip
FreeBSD-src-34829d74e1222ffb99ba5a0dc56d3a62c7813ca5.tar.gz
Provide one global language string descriptor for
american english instead of giving each module its own. Submitted by: Christoph Mallon
-rw-r--r--sys/dev/usb/controller/at91dci.c8
-rw-r--r--sys/dev/usb/controller/atmegadci.c8
-rw-r--r--sys/dev/usb/controller/avr32dci.c8
-rw-r--r--sys/dev/usb/controller/dwc_otg.c8
-rw-r--r--sys/dev/usb/controller/musb_otg.c8
-rw-r--r--sys/dev/usb/controller/uss820dci.c8
-rw-r--r--sys/dev/usb/template/usb_template_audio.c9
-rw-r--r--sys/dev/usb/template/usb_template_cdce.c9
-rw-r--r--sys/dev/usb/template/usb_template_kbd.c9
-rw-r--r--sys/dev/usb/template/usb_template_modem.c9
-rw-r--r--sys/dev/usb/template/usb_template_mouse.c9
-rw-r--r--sys/dev/usb/template/usb_template_msc.c9
-rw-r--r--sys/dev/usb/template/usb_template_mtp.c10
-rw-r--r--sys/dev/usb/usb.h7
-rw-r--r--sys/dev/usb/usb_core.c5
-rw-r--r--sys/dev/usb/usb_core.h2
16 files changed, 48 insertions, 78 deletions
diff --git a/sys/dev/usb/controller/at91dci.c b/sys/dev/usb/controller/at91dci.c
index aef287d..3b0c773 100644
--- a/sys/dev/usb/controller/at91dci.c
+++ b/sys/dev/usb/controller/at91dci.c
@@ -1740,9 +1740,6 @@ static const struct usb_hub_descriptor_min at91dci_hubd = {
.DeviceRemovable = {0}, /* port is removable */
};
-#define STRING_LANG \
- 0x09, 0x04, /* American English */
-
#define STRING_VENDOR \
'A', 0, 'T', 0, 'M', 0, 'E', 0, 'L', 0
@@ -1751,7 +1748,6 @@ static const struct usb_hub_descriptor_min at91dci_hubd = {
'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \
'U', 0, 'B', 0,
-USB_MAKE_STRING_DESC(STRING_LANG, at91dci_langtab);
USB_MAKE_STRING_DESC(STRING_VENDOR, at91dci_vendor);
USB_MAKE_STRING_DESC(STRING_PRODUCT, at91dci_product);
@@ -1953,8 +1949,8 @@ tr_handle_get_descriptor:
case UDESC_STRING:
switch (value & 0xff) {
case 0: /* Language table */
- len = sizeof(at91dci_langtab);
- ptr = (const void *)&at91dci_langtab;
+ len = sizeof(usb_string_lang_en);
+ ptr = (const void *)&usb_string_lang_en;
goto tr_valid;
case 1: /* Vendor */
diff --git a/sys/dev/usb/controller/atmegadci.c b/sys/dev/usb/controller/atmegadci.c
index 70d34a3..426073e 100644
--- a/sys/dev/usb/controller/atmegadci.c
+++ b/sys/dev/usb/controller/atmegadci.c
@@ -1565,9 +1565,6 @@ static const struct usb_hub_descriptor_min atmegadci_hubd = {
.DeviceRemovable = {0}, /* port is removable */
};
-#define STRING_LANG \
- 0x09, 0x04, /* American English */
-
#define STRING_VENDOR \
'A', 0, 'T', 0, 'M', 0, 'E', 0, 'G', 0, 'A', 0
@@ -1576,7 +1573,6 @@ static const struct usb_hub_descriptor_min atmegadci_hubd = {
'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \
'U', 0, 'B', 0,
-USB_MAKE_STRING_DESC(STRING_LANG, atmegadci_langtab);
USB_MAKE_STRING_DESC(STRING_VENDOR, atmegadci_vendor);
USB_MAKE_STRING_DESC(STRING_PRODUCT, atmegadci_product);
@@ -1779,8 +1775,8 @@ tr_handle_get_descriptor:
case UDESC_STRING:
switch (value & 0xff) {
case 0: /* Language table */
- len = sizeof(atmegadci_langtab);
- ptr = (const void *)&atmegadci_langtab;
+ len = sizeof(usb_string_lang_en);
+ ptr = (const void *)&usb_string_lang_en;
goto tr_valid;
case 1: /* Vendor */
diff --git a/sys/dev/usb/controller/avr32dci.c b/sys/dev/usb/controller/avr32dci.c
index 0828311..e0244f5 100644
--- a/sys/dev/usb/controller/avr32dci.c
+++ b/sys/dev/usb/controller/avr32dci.c
@@ -1505,9 +1505,6 @@ static const struct usb_hub_descriptor_min avr32dci_hubd = {
.DeviceRemovable = {0}, /* port is removable */
};
-#define STRING_LANG \
- 0x09, 0x04, /* American English */
-
#define STRING_VENDOR \
'A', 0, 'V', 0, 'R', 0, '3', 0, '2', 0
@@ -1516,7 +1513,6 @@ static const struct usb_hub_descriptor_min avr32dci_hubd = {
'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \
'U', 0, 'B', 0,
-USB_MAKE_STRING_DESC(STRING_LANG, avr32dci_langtab);
USB_MAKE_STRING_DESC(STRING_VENDOR, avr32dci_vendor);
USB_MAKE_STRING_DESC(STRING_PRODUCT, avr32dci_product);
@@ -1719,8 +1715,8 @@ tr_handle_get_descriptor:
case UDESC_STRING:
switch (value & 0xff) {
case 0: /* Language table */
- len = sizeof(avr32dci_langtab);
- ptr = (const void *)&avr32dci_langtab;
+ len = sizeof(usb_string_lang_en);
+ ptr = (const void *)&usb_string_lang_en;
goto tr_valid;
case 1: /* Vendor */
diff --git a/sys/dev/usb/controller/dwc_otg.c b/sys/dev/usb/controller/dwc_otg.c
index e161ab7..77dda2b 100644
--- a/sys/dev/usb/controller/dwc_otg.c
+++ b/sys/dev/usb/controller/dwc_otg.c
@@ -3491,9 +3491,6 @@ static const struct usb_hub_descriptor_min dwc_otg_hubd = {
.DeviceRemovable = {0}, /* port is removable */
};
-#define STRING_LANG \
- 0x09, 0x04, /* American English */
-
#define STRING_VENDOR \
'D', 0, 'W', 0, 'C', 0, 'O', 0, 'T', 0, 'G', 0
@@ -3502,7 +3499,6 @@ static const struct usb_hub_descriptor_min dwc_otg_hubd = {
'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \
'U', 0, 'B', 0,
-USB_MAKE_STRING_DESC(STRING_LANG, dwc_otg_langtab);
USB_MAKE_STRING_DESC(STRING_VENDOR, dwc_otg_vendor);
USB_MAKE_STRING_DESC(STRING_PRODUCT, dwc_otg_product);
@@ -3704,8 +3700,8 @@ tr_handle_get_descriptor:
case UDESC_STRING:
switch (value & 0xff) {
case 0: /* Language table */
- len = sizeof(dwc_otg_langtab);
- ptr = (const void *)&dwc_otg_langtab;
+ len = sizeof(usb_string_lang_en);
+ ptr = (const void *)&usb_string_lang_en;
goto tr_valid;
case 1: /* Vendor */
diff --git a/sys/dev/usb/controller/musb_otg.c b/sys/dev/usb/controller/musb_otg.c
index 90f69b7..0bf2802 100644
--- a/sys/dev/usb/controller/musb_otg.c
+++ b/sys/dev/usb/controller/musb_otg.c
@@ -2211,9 +2211,6 @@ static const struct usb_hub_descriptor_min musbotg_hubd = {
.DeviceRemovable = {0}, /* port is removable */
};
-#define STRING_LANG \
- 0x09, 0x04, /* American English */
-
#define STRING_VENDOR \
'M', 0, 'e', 0, 'n', 0, 't', 0, 'o', 0, 'r', 0, ' ', 0, \
'G', 0, 'r', 0, 'a', 0, 'p', 0, 'h', 0, 'i', 0, 'c', 0, 's', 0
@@ -2223,7 +2220,6 @@ static const struct usb_hub_descriptor_min musbotg_hubd = {
'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \
'U', 0, 'B', 0,
-USB_MAKE_STRING_DESC(STRING_LANG, musbotg_langtab);
USB_MAKE_STRING_DESC(STRING_VENDOR, musbotg_vendor);
USB_MAKE_STRING_DESC(STRING_PRODUCT, musbotg_product);
@@ -2425,8 +2421,8 @@ tr_handle_get_descriptor:
case UDESC_STRING:
switch (value & 0xff) {
case 0: /* Language table */
- len = sizeof(musbotg_langtab);
- ptr = (const void *)&musbotg_langtab;
+ len = sizeof(usb_string_lang_en);
+ ptr = (const void *)&usb_string_lang_en;
goto tr_valid;
case 1: /* Vendor */
diff --git a/sys/dev/usb/controller/uss820dci.c b/sys/dev/usb/controller/uss820dci.c
index bb1d847..ffb6cc8 100644
--- a/sys/dev/usb/controller/uss820dci.c
+++ b/sys/dev/usb/controller/uss820dci.c
@@ -1808,9 +1808,6 @@ static const struct usb_hub_descriptor_min uss820dci_hubd = {
.DeviceRemovable = {0}, /* port is removable */
};
-#define STRING_LANG \
- 0x09, 0x04, /* American English */
-
#define STRING_VENDOR \
'A', 0, 'G', 0, 'E', 0, 'R', 0, 'E', 0
@@ -1819,7 +1816,6 @@ static const struct usb_hub_descriptor_min uss820dci_hubd = {
'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \
'U', 0, 'B', 0,
-USB_MAKE_STRING_DESC(STRING_LANG, uss820dci_langtab);
USB_MAKE_STRING_DESC(STRING_VENDOR, uss820dci_vendor);
USB_MAKE_STRING_DESC(STRING_PRODUCT, uss820dci_product);
@@ -2021,8 +2017,8 @@ tr_handle_get_descriptor:
case UDESC_STRING:
switch (value & 0xff) {
case 0: /* Language table */
- len = sizeof(uss820dci_langtab);
- ptr = (const void *)&uss820dci_langtab;
+ len = sizeof(usb_string_lang_en);
+ ptr = (const void *)&usb_string_lang_en;
goto tr_valid;
case 1: /* Vendor */
diff --git a/sys/dev/usb/template/usb_template_audio.c b/sys/dev/usb/template/usb_template_audio.c
index cc60a33..f40c601 100644
--- a/sys/dev/usb/template/usb_template_audio.c
+++ b/sys/dev/usb/template/usb_template_audio.c
@@ -52,6 +52,7 @@
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
+#include <dev/usb/usb_core.h>
#include <dev/usb/usb_cdc.h>
#include <dev/usb/template/usb_template.h>
@@ -66,9 +67,6 @@ enum {
INDEX_AUDIO_MAX,
};
-#define STRING_LANG \
- 0x09, 0x04, /* American English */
-
#define STRING_AUDIO_PRODUCT \
'A', 0, 'u', 0, 'd', 0, 'i', 0, 'o', 0, ' ', 0, \
'T', 0, 'e', 0, 's', 0, 't', 0, ' ', 0, \
@@ -89,7 +87,6 @@ enum {
/* make the real string descriptors */
-USB_MAKE_STRING_DESC(STRING_LANG, string_lang);
USB_MAKE_STRING_DESC(STRING_AUDIO_MIXER, string_audio_mixer);
USB_MAKE_STRING_DESC(STRING_AUDIO_RECORD, string_audio_record);
USB_MAKE_STRING_DESC(STRING_AUDIO_PLAYBACK, string_audio_playback);
@@ -387,7 +384,7 @@ static const void *
audio_get_string_desc(uint16_t lang_id, uint8_t string_index)
{
static const void *ptr[INDEX_AUDIO_MAX] = {
- [INDEX_AUDIO_LANG] = &string_lang,
+ [INDEX_AUDIO_LANG] = &usb_string_lang_en,
[INDEX_AUDIO_MIXER] = &string_audio_mixer,
[INDEX_AUDIO_RECORD] = &string_audio_record,
[INDEX_AUDIO_PLAYBACK] = &string_audio_playback,
@@ -395,7 +392,7 @@ audio_get_string_desc(uint16_t lang_id, uint8_t string_index)
};
if (string_index == 0) {
- return (&string_lang);
+ return (&usb_string_lang_en);
}
if (lang_id != 0x0409) {
return (NULL);
diff --git a/sys/dev/usb/template/usb_template_cdce.c b/sys/dev/usb/template/usb_template_cdce.c
index 61dea38..3bc5e3e 100644
--- a/sys/dev/usb/template/usb_template_cdce.c
+++ b/sys/dev/usb/template/usb_template_cdce.c
@@ -53,6 +53,7 @@
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
+#include <dev/usb/usb_core.h>
#include <dev/usb/usb_cdc.h>
#include <dev/usb/template/usb_template.h>
@@ -70,9 +71,6 @@ enum {
STRING_ETH_MAX,
};
-#define STRING_LANG \
- 0x09, 0x04, /* American English */
-
#define STRING_MAC \
'2', 0, 'A', 0, '2', 0, '3', 0, \
'4', 0, '5', 0, '6', 0, '7', 0, \
@@ -124,7 +122,6 @@ enum {
/* make the real string descriptors */
-USB_MAKE_STRING_DESC(STRING_LANG, string_lang);
USB_MAKE_STRING_DESC(STRING_MAC, string_mac);
USB_MAKE_STRING_DESC(STRING_ETH_CONTROL, string_eth_control);
USB_MAKE_STRING_DESC(STRING_ETH_DATA, string_eth_data);
@@ -288,7 +285,7 @@ static const void *
eth_get_string_desc(uint16_t lang_id, uint8_t string_index)
{
static const void *ptr[STRING_ETH_MAX] = {
- [STRING_LANG_INDEX] = &string_lang,
+ [STRING_LANG_INDEX] = &usb_string_lang_en,
[STRING_MAC_INDEX] = &string_mac,
[STRING_ETH_CONTROL_INDEX] = &string_eth_control,
[STRING_ETH_DATA_INDEX] = &string_eth_data,
@@ -299,7 +296,7 @@ eth_get_string_desc(uint16_t lang_id, uint8_t string_index)
};
if (string_index == 0) {
- return (&string_lang);
+ return (&usb_string_lang_en);
}
if (lang_id != 0x0409) {
return (NULL);
diff --git a/sys/dev/usb/template/usb_template_kbd.c b/sys/dev/usb/template/usb_template_kbd.c
index 8866edd..0538f46 100644
--- a/sys/dev/usb/template/usb_template_kbd.c
+++ b/sys/dev/usb/template/usb_template_kbd.c
@@ -52,6 +52,7 @@
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
+#include <dev/usb/usb_core.h>
#include <dev/usb/usb_cdc.h>
#include <dev/usb/template/usb_template.h>
@@ -64,9 +65,6 @@ enum {
INDEX_MAX,
};
-#define STRING_LANG \
- 0x09, 0x04, /* American English */
-
#define STRING_PRODUCT \
'K', 0, 'e', 0, 'y', 0, 'b', 0, 'o', 0, 'a', 0, 'r', 0, 'd', 0, ' ', 0, \
'T', 0, 'e', 0, 's', 0, 't', 0, ' ', 0, \
@@ -78,7 +76,6 @@ enum {
/* make the real string descriptors */
-USB_MAKE_STRING_DESC(STRING_LANG, string_lang);
USB_MAKE_STRING_DESC(STRING_KEYBOARD, string_keyboard);
USB_MAKE_STRING_DESC(STRING_PRODUCT, string_product);
@@ -208,13 +205,13 @@ static const void *
keyboard_get_string_desc(uint16_t lang_id, uint8_t string_index)
{
static const void *ptr[INDEX_MAX] = {
- [INDEX_LANG] = &string_lang,
+ [INDEX_LANG] = &usb_string_lang_en,
[INDEX_KEYBOARD] = &string_keyboard,
[INDEX_PRODUCT] = &string_product,
};
if (string_index == 0) {
- return (&string_lang);
+ return (&usb_string_lang_en);
}
if (lang_id != 0x0409) {
return (NULL);
diff --git a/sys/dev/usb/template/usb_template_modem.c b/sys/dev/usb/template/usb_template_modem.c
index 3b74134..784c795 100644
--- a/sys/dev/usb/template/usb_template_modem.c
+++ b/sys/dev/usb/template/usb_template_modem.c
@@ -52,6 +52,7 @@
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
+#include <dev/usb/usb_core.h>
#include <dev/usb/usb_cdc.h>
#include <dev/usb/template/usb_template.h>
@@ -64,9 +65,6 @@ enum {
INDEX_MAX,
};
-#define STRING_LANG \
- 0x09, 0x04, /* American English */
-
#define STRING_PRODUCT \
'M', 0, 'o', 0, 'd', 0, 'e', 0, 'm', 0, ' ', 0, \
'T', 0, 'e', 0, 's', 0, 't', 0, ' ', 0, \
@@ -78,7 +76,6 @@ enum {
/* make the real string descriptors */
-USB_MAKE_STRING_DESC(STRING_LANG, string_lang);
USB_MAKE_STRING_DESC(STRING_MODEM, string_modem);
USB_MAKE_STRING_DESC(STRING_PRODUCT, string_product);
@@ -236,13 +233,13 @@ static const void *
modem_get_string_desc(uint16_t lang_id, uint8_t string_index)
{
static const void *ptr[INDEX_MAX] = {
- [INDEX_LANG] = &string_lang,
+ [INDEX_LANG] = &usb_string_lang_en,
[INDEX_MODEM] = &string_modem,
[INDEX_PRODUCT] = &string_product,
};
if (string_index == 0) {
- return (&string_lang);
+ return (&usb_string_lang_en);
}
if (lang_id != 0x0409) {
return (NULL);
diff --git a/sys/dev/usb/template/usb_template_mouse.c b/sys/dev/usb/template/usb_template_mouse.c
index abe8650..570a70c 100644
--- a/sys/dev/usb/template/usb_template_mouse.c
+++ b/sys/dev/usb/template/usb_template_mouse.c
@@ -52,6 +52,7 @@
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
+#include <dev/usb/usb_core.h>
#include <dev/usb/usb_cdc.h>
#include <dev/usb/template/usb_template.h>
@@ -64,9 +65,6 @@ enum {
INDEX_MAX,
};
-#define STRING_LANG \
- 0x09, 0x04, /* American English */
-
#define STRING_PRODUCT \
'M', 0, 'o', 0, 'u', 0, 's', 0, 'e', 0, ' ', 0, \
'T', 0, 'e', 0, 's', 0, 't', 0, ' ', 0, \
@@ -78,7 +76,6 @@ enum {
/* make the real string descriptors */
-USB_MAKE_STRING_DESC(STRING_LANG, string_lang);
USB_MAKE_STRING_DESC(STRING_MOUSE, string_mouse);
USB_MAKE_STRING_DESC(STRING_PRODUCT, string_product);
@@ -206,13 +203,13 @@ static const void *
mouse_get_string_desc(uint16_t lang_id, uint8_t string_index)
{
static const void *ptr[INDEX_MAX] = {
- [INDEX_LANG] = &string_lang,
+ [INDEX_LANG] = &usb_string_lang_en,
[INDEX_MOUSE] = &string_mouse,
[INDEX_PRODUCT] = &string_product,
};
if (string_index == 0) {
- return (&string_lang);
+ return (&usb_string_lang_en);
}
if (lang_id != 0x0409) {
return (NULL);
diff --git a/sys/dev/usb/template/usb_template_msc.c b/sys/dev/usb/template/usb_template_msc.c
index 3153433..3d13fee 100644
--- a/sys/dev/usb/template/usb_template_msc.c
+++ b/sys/dev/usb/template/usb_template_msc.c
@@ -53,6 +53,7 @@
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
+#include <dev/usb/usb_core.h>
#include <dev/usb/template/usb_template.h>
#endif /* USB_GLOBAL_INCLUDE_FILE */
@@ -67,9 +68,6 @@ enum {
STRING_MSC_MAX,
};
-#define STRING_LANG \
- 0x09, 0x04, /* American English */
-
#define STRING_MSC_DATA \
'U', 0, 'S', 0, 'B', 0, ' ', 0, \
'M', 0, 'a', 0, 's', 0, 's', 0, \
@@ -105,7 +103,6 @@ enum {
/* make the real string descriptors */
-USB_MAKE_STRING_DESC(STRING_LANG, string_lang);
USB_MAKE_STRING_DESC(STRING_MSC_DATA, string_msc_data);
USB_MAKE_STRING_DESC(STRING_MSC_CONFIG, string_msc_config);
USB_MAKE_STRING_DESC(STRING_MSC_VENDOR, string_msc_vendor);
@@ -197,7 +194,7 @@ static const void *
msc_get_string_desc(uint16_t lang_id, uint8_t string_index)
{
static const void *ptr[STRING_MSC_MAX] = {
- [STRING_LANG_INDEX] = &string_lang,
+ [STRING_LANG_INDEX] = &usb_string_lang_en,
[STRING_MSC_DATA_INDEX] = &string_msc_data,
[STRING_MSC_CONFIG_INDEX] = &string_msc_config,
[STRING_MSC_VENDOR_INDEX] = &string_msc_vendor,
@@ -206,7 +203,7 @@ msc_get_string_desc(uint16_t lang_id, uint8_t string_index)
};
if (string_index == 0) {
- return (&string_lang);
+ return (&usb_string_lang_en);
}
if (lang_id != 0x0409) {
return (NULL);
diff --git a/sys/dev/usb/template/usb_template_mtp.c b/sys/dev/usb/template/usb_template_mtp.c
index d4112e6..e4c3c7e 100644
--- a/sys/dev/usb/template/usb_template_mtp.c
+++ b/sys/dev/usb/template/usb_template_mtp.c
@@ -60,6 +60,8 @@
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
+#include <dev/usb/usb_core.h>
+
#include <dev/usb/template/usb_template.h>
#endif /* USB_GLOBAL_INCLUDE_FILE */
@@ -75,9 +77,6 @@ enum {
STRING_MTP_MAX,
};
-#define STRING_LANG \
- 0x09, 0x04, /* American English */
-
#define STRING_MTP_DATA \
'U', 0, 'S', 0, 'B', 0, ' ', 0, \
'M', 0, 'T', 0, 'P', 0, \
@@ -109,7 +108,6 @@ enum {
/* make the real string descriptors */
-USB_MAKE_STRING_DESC(STRING_LANG, string_lang);
USB_MAKE_STRING_DESC(STRING_MTP_DATA, string_mtp_data);
USB_MAKE_STRING_DESC(STRING_MTP_CONFIG, string_mtp_config);
USB_MAKE_STRING_DESC(STRING_MTP_VENDOR, string_mtp_vendor);
@@ -246,7 +244,7 @@ static const void *
mtp_get_string_desc(uint16_t lang_id, uint8_t string_index)
{
static const void *ptr[STRING_MTP_MAX] = {
- [STRING_LANG_INDEX] = &string_lang,
+ [STRING_LANG_INDEX] = &usb_string_lang_en,
[STRING_MTP_DATA_INDEX] = &string_mtp_data,
[STRING_MTP_CONFIG_INDEX] = &string_mtp_config,
[STRING_MTP_VENDOR_INDEX] = &string_mtp_vendor,
@@ -268,7 +266,7 @@ mtp_get_string_desc(uint16_t lang_id, uint8_t string_index)
return (dummy_desc);
}
if (string_index == 0) {
- return (&string_lang);
+ return (&usb_string_lang_en);
}
if (lang_id != 0x0409) {
return (NULL);
diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h
index 438dc3c..7a10c30 100644
--- a/sys/dev/usb/usb.h
+++ b/sys/dev/usb/usb.h
@@ -577,6 +577,13 @@ static const struct name name = { \
.bData = { m }, \
}
+struct usb_string_lang {
+ uByte bLength;
+ uByte bDescriptorType;
+ uByte bData[2];
+} __packed;
+typedef struct usb_string_lang usb_string_lang_t;
+
struct usb_hub_descriptor {
uByte bDescLength;
uByte bDescriptorType;
diff --git a/sys/dev/usb/usb_core.c b/sys/dev/usb/usb_core.c
index 0ebbdc0..8a5b93c 100644
--- a/sys/dev/usb/usb_core.c
+++ b/sys/dev/usb/usb_core.c
@@ -56,6 +56,11 @@
#include <dev/usb/usbdi.h>
#endif /* USB_GLOBAL_INCLUDE_FILE */
+const struct usb_string_lang usb_string_lang_en = {
+ sizeof(usb_string_lang_en), UDESC_STRING,
+ { 0x09, 0x04 } /* American English */
+};
+
MALLOC_DEFINE(M_USB, "USB", "USB");
MALLOC_DEFINE(M_USBDEV, "USBdev", "USB device");
MALLOC_DEFINE(M_USBHC, "USBHC", "USB host controller");
diff --git a/sys/dev/usb/usb_core.h b/sys/dev/usb/usb_core.h
index 776cf17..afd74ed 100644
--- a/sys/dev/usb/usb_core.h
+++ b/sys/dev/usb/usb_core.h
@@ -69,6 +69,7 @@ struct usb_page;
struct usb_page_cache;
struct usb_xfer;
struct usb_xfer_root;
+struct usb_string_lang;
/* typedefs */
@@ -174,6 +175,7 @@ struct usb_xfer {
/* external variables */
extern struct mtx usb_ref_lock;
+extern const struct usb_string_lang usb_string_lang_en;
/* typedefs */
OpenPOWER on IntegriCloud