提交 d7239f4c 编写于 作者: A Andrzej Pietrasiewicz 提交者: Felipe Balbi

usb: gadget: printer: name class specific requests

Avoid using magic numbers.
Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 f563d230
...@@ -47,6 +47,9 @@ USB_GADGET_COMPOSITE_OPTIONS(); ...@@ -47,6 +47,9 @@ USB_GADGET_COMPOSITE_OPTIONS();
#define DRIVER_DESC "Printer Gadget" #define DRIVER_DESC "Printer Gadget"
#define DRIVER_VERSION "2007 OCT 06" #define DRIVER_VERSION "2007 OCT 06"
#define GET_DEVICE_ID 0
#define GET_PORT_STATUS 1
#define SOFT_RESET 2
static const char shortname [] = "printer"; static const char shortname [] = "printer";
static const char driver_desc [] = DRIVER_DESC; static const char driver_desc [] = DRIVER_DESC;
...@@ -992,7 +995,7 @@ static int printer_func_setup(struct usb_function *f, ...@@ -992,7 +995,7 @@ static int printer_func_setup(struct usb_function *f,
switch (ctrl->bRequestType&USB_TYPE_MASK) { switch (ctrl->bRequestType&USB_TYPE_MASK) {
case USB_TYPE_CLASS: case USB_TYPE_CLASS:
switch (ctrl->bRequest) { switch (ctrl->bRequest) {
case 0: /* Get the IEEE-1284 PNP String */ case GET_DEVICE_ID: /* Get the IEEE-1284 PNP String */
/* Only one printer interface is supported. */ /* Only one printer interface is supported. */
if ((wIndex>>8) != dev->interface) if ((wIndex>>8) != dev->interface)
break; break;
...@@ -1003,7 +1006,7 @@ static int printer_func_setup(struct usb_function *f, ...@@ -1003,7 +1006,7 @@ static int printer_func_setup(struct usb_function *f,
&dev->pnp_string[2]); &dev->pnp_string[2]);
break; break;
case 1: /* Get Port Status */ case GET_PORT_STATUS: /* Get Port Status */
/* Only one printer interface is supported. */ /* Only one printer interface is supported. */
if (wIndex != dev->interface) if (wIndex != dev->interface)
break; break;
...@@ -1012,7 +1015,7 @@ static int printer_func_setup(struct usb_function *f, ...@@ -1012,7 +1015,7 @@ static int printer_func_setup(struct usb_function *f,
value = min(wLength, (u16) 1); value = min(wLength, (u16) 1);
break; break;
case 2: /* Soft Reset */ case SOFT_RESET: /* Soft Reset */
/* Only one printer interface is supported. */ /* Only one printer interface is supported. */
if (wIndex != dev->interface) if (wIndex != dev->interface)
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册