Replace some magic numbers in usb_template(4) code with #defines.

There should be no functional changes.

Reviewed by:	hselasky
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12670
This commit is contained in:
trasz 2017-10-15 11:46:11 +00:00
parent f2b092e92d
commit 0cfef29a85
7 changed files with 44 additions and 44 deletions

View File

@ -199,8 +199,8 @@ static const void *audio_raw_iface_0_desc[] = {
static const struct usb_temp_interface_desc audio_iface_0 = {
.ppEndpoints = NULL, /* no endpoints */
.ppRawDesc = audio_raw_iface_0_desc,
.bInterfaceClass = 1,
.bInterfaceSubClass = 1,
.bInterfaceClass = UICLASS_AUDIO,
.bInterfaceSubClass = UISUBCLASS_AUDIOCONTROL,
.bInterfaceProtocol = 0,
.iInterface = INDEX_AUDIO_MIXER,
};
@ -257,8 +257,8 @@ static const struct usb_temp_endpoint_desc *audio_iface_1_ep[] = {
static const struct usb_temp_interface_desc audio_iface_1_alt_0 = {
.ppEndpoints = NULL, /* no endpoints */
.ppRawDesc = NULL, /* no raw descriptors */
.bInterfaceClass = 1,
.bInterfaceSubClass = 2,
.bInterfaceClass = UICLASS_AUDIO,
.bInterfaceSubClass = UISUBCLASS_AUDIOSTREAM,
.bInterfaceProtocol = 0,
.iInterface = INDEX_AUDIO_PLAYBACK,
};
@ -266,8 +266,8 @@ static const struct usb_temp_interface_desc audio_iface_1_alt_0 = {
static const struct usb_temp_interface_desc audio_iface_1_alt_1 = {
.ppEndpoints = audio_iface_1_ep,
.ppRawDesc = audio_raw_iface_1_desc,
.bInterfaceClass = 1,
.bInterfaceSubClass = 2,
.bInterfaceClass = UICLASS_AUDIO,
.bInterfaceSubClass = UISUBCLASS_AUDIOSTREAM,
.bInterfaceProtocol = 0,
.iInterface = INDEX_AUDIO_PLAYBACK,
.isAltInterface = 1, /* this is an alternate setting */
@ -315,8 +315,8 @@ static const struct usb_temp_endpoint_desc *audio_iface_2_ep[] = {
static const struct usb_temp_interface_desc audio_iface_2_alt_0 = {
.ppEndpoints = NULL, /* no endpoints */
.ppRawDesc = NULL, /* no raw descriptors */
.bInterfaceClass = 1,
.bInterfaceSubClass = 2,
.bInterfaceClass = UICLASS_AUDIO,
.bInterfaceSubClass = UISUBCLASS_AUDIOSTREAM,
.bInterfaceProtocol = 0,
.iInterface = INDEX_AUDIO_RECORD,
};
@ -324,8 +324,8 @@ static const struct usb_temp_interface_desc audio_iface_2_alt_0 = {
static const struct usb_temp_interface_desc audio_iface_2_alt_1 = {
.ppEndpoints = audio_iface_2_ep,
.ppRawDesc = audio_raw_iface_2_desc,
.bInterfaceClass = 1,
.bInterfaceSubClass = 2,
.bInterfaceClass = UICLASS_AUDIO,
.bInterfaceSubClass = UISUBCLASS_AUDIOSTREAM,
.bInterfaceProtocol = 0,
.iInterface = INDEX_AUDIO_RECORD,
.isAltInterface = 1, /* this is an alternate setting */

View File

@ -130,9 +130,9 @@ static const void *keyboard_iface_0_desc[] = {
static const struct usb_temp_interface_desc keyboard_iface_0 = {
.ppRawDesc = keyboard_iface_0_desc,
.ppEndpoints = keyboard_endpoints,
.bInterfaceClass = 3,
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 1,
.bInterfaceClass = UICLASS_HID,
.bInterfaceSubClass = UISUBCLASS_BOOT,
.bInterfaceProtocol = UIPROTO_BOOT_KEYBOARD,
.iInterface = INDEX_KEYBOARD,
};

View File

@ -89,8 +89,8 @@ static const void *midi_descs_0[] = {
static const struct usb_temp_interface_desc midi_iface_0 = {
.ppEndpoints = NULL, /* no endpoints */
.ppRawDesc = midi_descs_0,
.bInterfaceClass = 1,
.bInterfaceSubClass = 1,
.bInterfaceClass = UICLASS_AUDIO,
.bInterfaceSubClass = UISUBCLASS_AUDIOCONTROL,
.bInterfaceProtocol = 0,
.iInterface = INDEX_MIDI_IF,
};
@ -171,8 +171,8 @@ static const void *midi_descs_1[] = {
static const struct usb_temp_interface_desc midi_iface_1 = {
.ppRawDesc = midi_descs_1,
.ppEndpoints = midi_iface_1_ep,
.bInterfaceClass = 0x01, /* MIDI */
.bInterfaceSubClass = 3, /* MIDI streaming */
.bInterfaceClass = UICLASS_AUDIO,
.bInterfaceSubClass = UISUBCLASS_MIDISTREAM,
.bInterfaceProtocol = 0,
.iInterface = INDEX_MIDI_IF,
};

View File

@ -156,17 +156,17 @@ static const void *modem_iface_0_desc[] = {
static const struct usb_temp_interface_desc modem_iface_0 = {
.ppRawDesc = modem_iface_0_desc,
.ppEndpoints = modem_iface_0_ep,
.bInterfaceClass = 2,
.bInterfaceSubClass = 2,
.bInterfaceProtocol = 1,
.bInterfaceClass = UICLASS_CDC,
.bInterfaceSubClass = UISUBCLASS_ABSTRACT_CONTROL_MODEL,
.bInterfaceProtocol = UIPROTO_CDC_AT,
.iInterface = INDEX_MODEM,
};
static const struct usb_temp_interface_desc modem_iface_1 = {
.ppEndpoints = modem_iface_1_ep,
.bInterfaceClass = 10,
.bInterfaceSubClass = 0,
.bInterfaceProtocol = 0,
.bInterfaceClass = UICLASS_CDC_DATA,
.bInterfaceSubClass = UISUBCLASS_DATA,
.bInterfaceProtocol = UIPROTO_CDC_NONE,
.iInterface = INDEX_MODEM,
};

View File

@ -128,9 +128,9 @@ static const void *mouse_iface_0_desc[] = {
static const struct usb_temp_interface_desc mouse_iface_0 = {
.ppRawDesc = mouse_iface_0_desc,
.ppEndpoints = mouse_endpoints,
.bInterfaceClass = 3,
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 2,
.bInterfaceClass = UICLASS_HID,
.bInterfaceSubClass = UISUBCLASS_BOOT,
.bInterfaceProtocol = UIPROTO_MOUSE,
.iInterface = INDEX_MOUSE,
};

View File

@ -156,8 +156,8 @@ static const void *phone_raw_iface_0_desc[] = {
static const struct usb_temp_interface_desc phone_iface_0 = {
.ppEndpoints = NULL, /* no endpoints */
.ppRawDesc = phone_raw_iface_0_desc,
.bInterfaceClass = 1,
.bInterfaceSubClass = 1,
.bInterfaceClass = UICLASS_AUDIO,
.bInterfaceSubClass = UISUBCLASS_AUDIOCONTROL,
.bInterfaceProtocol = 0,
.iInterface = INDEX_PHONE_MIXER,
};
@ -213,8 +213,8 @@ static const struct usb_temp_endpoint_desc *phone_iface_1_ep[] = {
static const struct usb_temp_interface_desc phone_iface_1_alt_0 = {
.ppEndpoints = NULL, /* no endpoints */
.ppRawDesc = NULL, /* no raw descriptors */
.bInterfaceClass = 1,
.bInterfaceSubClass = 2,
.bInterfaceClass = UICLASS_AUDIO,
.bInterfaceSubClass = UISUBCLASS_AUDIOSTREAM,
.bInterfaceProtocol = 0,
.iInterface = INDEX_PHONE_PLAYBACK,
};
@ -222,8 +222,8 @@ static const struct usb_temp_interface_desc phone_iface_1_alt_0 = {
static const struct usb_temp_interface_desc phone_iface_1_alt_1 = {
.ppEndpoints = phone_iface_1_ep,
.ppRawDesc = phone_raw_iface_1_desc,
.bInterfaceClass = 1,
.bInterfaceSubClass = 2,
.bInterfaceClass = UICLASS_AUDIO,
.bInterfaceSubClass = UISUBCLASS_AUDIOSTREAM,
.bInterfaceProtocol = 0,
.iInterface = INDEX_PHONE_PLAYBACK,
.isAltInterface = 1, /* this is an alternate setting */
@ -270,8 +270,8 @@ static const struct usb_temp_endpoint_desc *phone_iface_2_ep[] = {
static const struct usb_temp_interface_desc phone_iface_2_alt_0 = {
.ppEndpoints = NULL, /* no endpoints */
.ppRawDesc = NULL, /* no raw descriptors */
.bInterfaceClass = 1,
.bInterfaceSubClass = 2,
.bInterfaceClass = UICLASS_AUDIO,
.bInterfaceSubClass = UISUBCLASS_AUDIOSTREAM,
.bInterfaceProtocol = 0,
.iInterface = INDEX_PHONE_RECORD,
};
@ -279,8 +279,8 @@ static const struct usb_temp_interface_desc phone_iface_2_alt_0 = {
static const struct usb_temp_interface_desc phone_iface_2_alt_1 = {
.ppEndpoints = phone_iface_2_ep,
.ppRawDesc = phone_raw_iface_2_desc,
.bInterfaceClass = 1,
.bInterfaceSubClass = 2,
.bInterfaceClass = UICLASS_AUDIO,
.bInterfaceSubClass = UISUBCLASS_AUDIOSTREAM,
.bInterfaceProtocol = 0,
.iInterface = INDEX_PHONE_RECORD,
.isAltInterface = 1, /* this is an alternate setting */
@ -321,7 +321,7 @@ static const struct usb_temp_endpoint_desc *phone_iface_3_ep[] = {
static const struct usb_temp_interface_desc phone_iface_3 = {
.ppEndpoints = phone_iface_3_ep,
.ppRawDesc = phone_hid_desc_0,
.bInterfaceClass = 3,
.bInterfaceClass = UICLASS_HID,
.bInterfaceSubClass = 0,
.bInterfaceProtocol = 0,
.iInterface = INDEX_PHONE_HID,

View File

@ -202,7 +202,7 @@ static const struct usb_temp_interface_desc eth_control_interface = {
.ppRawDesc = eth_control_if_desc,
.bInterfaceClass = UICLASS_CDC,
.bInterfaceSubClass = UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL,
.bInterfaceProtocol = 0,
.bInterfaceProtocol = UIPROTO_CDC_NONE,
.iInterface = STRING_ETH_CONTROL_INDEX,
};
@ -215,7 +215,7 @@ static const struct usb_temp_endpoint_desc *eth_data_endpoints[] = {
static const struct usb_temp_interface_desc eth_data_null_interface = {
.ppEndpoints = NULL, /* no endpoints */
.bInterfaceClass = UICLASS_CDC_DATA,
.bInterfaceSubClass = 0,
.bInterfaceSubClass = UISUBCLASS_DATA,
.bInterfaceProtocol = 0,
.iInterface = STRING_ETH_DATA_INDEX,
};
@ -304,16 +304,16 @@ static const void *modem_iface_0_desc[] = {
static const struct usb_temp_interface_desc modem_iface_0 = {
.ppRawDesc = modem_iface_0_desc,
.ppEndpoints = modem_iface_0_ep,
.bInterfaceClass = 2,
.bInterfaceSubClass = 2,
.bInterfaceProtocol = 1,
.bInterfaceClass = UICLASS_CDC,
.bInterfaceSubClass = UISUBCLASS_ABSTRACT_CONTROL_MODEL,
.bInterfaceProtocol = UIPROTO_CDC_AT,
.iInterface = STRING_MODEM_INDEX,
};
static const struct usb_temp_interface_desc modem_iface_1 = {
.ppEndpoints = modem_iface_1_ep,
.bInterfaceClass = 10,
.bInterfaceSubClass = 0,
.bInterfaceClass = UICLASS_CDC_DATA,
.bInterfaceSubClass = UISUBCLASS_DATA,
.bInterfaceProtocol = 0,
.iInterface = STRING_MODEM_INDEX,
};