Author: trasz
Date: Mon Apr 16 15:39:34 2018
New Revision: 332574
URL: https://svnweb.freebsd.org/changeset/base/332574

Log:
  MFC r324626:
  
  Replace some magic numbers in usb_template(4) code with #defines.
  There should be no functional changes.

Modified:
  stable/11/sys/dev/usb/template/usb_template_audio.c
  stable/11/sys/dev/usb/template/usb_template_kbd.c
  stable/11/sys/dev/usb/template/usb_template_midi.c
  stable/11/sys/dev/usb/template/usb_template_modem.c
  stable/11/sys/dev/usb/template/usb_template_mouse.c
  stable/11/sys/dev/usb/template/usb_template_phone.c
  stable/11/sys/dev/usb/template/usb_template_serialnet.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/template/usb_template_audio.c
==============================================================================
--- stable/11/sys/dev/usb/template/usb_template_audio.c Mon Apr 16 15:13:18 
2018        (r332573)
+++ stable/11/sys/dev/usb/template/usb_template_audio.c Mon Apr 16 15:39:34 
2018        (r332574)
@@ -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_ifac
 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_ifac
 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_ifac
 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_ifac
 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 */

Modified: stable/11/sys/dev/usb/template/usb_template_kbd.c
==============================================================================
--- stable/11/sys/dev/usb/template/usb_template_kbd.c   Mon Apr 16 15:13:18 
2018        (r332573)
+++ stable/11/sys/dev/usb/template/usb_template_kbd.c   Mon Apr 16 15:39:34 
2018        (r332574)
@@ -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,
 };
 

Modified: stable/11/sys/dev/usb/template/usb_template_midi.c
==============================================================================
--- stable/11/sys/dev/usb/template/usb_template_midi.c  Mon Apr 16 15:13:18 
2018        (r332573)
+++ stable/11/sys/dev/usb/template/usb_template_midi.c  Mon Apr 16 15:39:34 
2018        (r332574)
@@ -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,
 };

Modified: stable/11/sys/dev/usb/template/usb_template_modem.c
==============================================================================
--- stable/11/sys/dev/usb/template/usb_template_modem.c Mon Apr 16 15:13:18 
2018        (r332573)
+++ stable/11/sys/dev/usb/template/usb_template_modem.c Mon Apr 16 15:39:34 
2018        (r332574)
@@ -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,
 };
 

Modified: stable/11/sys/dev/usb/template/usb_template_mouse.c
==============================================================================
--- stable/11/sys/dev/usb/template/usb_template_mouse.c Mon Apr 16 15:13:18 
2018        (r332573)
+++ stable/11/sys/dev/usb/template/usb_template_mouse.c Mon Apr 16 15:39:34 
2018        (r332574)
@@ -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,
 };
 

Modified: stable/11/sys/dev/usb/template/usb_template_phone.c
==============================================================================
--- stable/11/sys/dev/usb/template/usb_template_phone.c Mon Apr 16 15:13:18 
2018        (r332573)
+++ stable/11/sys/dev/usb/template/usb_template_phone.c Mon Apr 16 15:39:34 
2018        (r332574)
@@ -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_ifac
 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_ifac
 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_ifac
 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_ifac
 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_ifac
 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,

Modified: stable/11/sys/dev/usb/template/usb_template_serialnet.c
==============================================================================
--- stable/11/sys/dev/usb/template/usb_template_serialnet.c     Mon Apr 16 
15:13:18 2018        (r332573)
+++ stable/11/sys/dev/usb/template/usb_template_serialnet.c     Mon Apr 16 
15:39:34 2018        (r332574)
@@ -202,7 +202,7 @@ static const struct usb_temp_interface_desc eth_contro
        .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_e
 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,
 };
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to