5 #include "usb_driver.h"
7 static struct devmand_usb_driver
*current_drv
;
8 static struct devmand_usb_match_id
*current_id
;
14 fprintf
(stderr
,"parsing error: %s\n",s
);
28 %token
<string> USB_DRIVER DEV_PREFIX BINARY INTERFACE_CLASS INTERFACE_SUB_CLASS EQUALS DEV_TYPE BLOCK_DEV CHAR_DEV UPSCRIPT DOWNSCRIPT
29 SEMICOLON BRACKET_OPEN BRACKET_CLOSE STRING ID INTERFACE_PROTOCOL
41 USB_DRIVER STRING
{current_drv
= add_usb_driver
($2);}
43 usb_driver_statements BRACKET_CLOSE
47 usb_driver_statements:
51 | usb_driver_statements usb_driver_statement
56 {current_id
= add_usb_match_id
(current_drv
);}
57 ID BRACKET_OPEN usb_device_id_statements BRACKET_CLOSE
60 | BINARY EQUALS STRING SEMICOLON
62 current_drv
->binary
= $3;
64 | DEV_PREFIX EQUALS STRING SEMICOLON
66 current_drv
->devprefix
= $3;
68 | DEV_TYPE EQUALS BLOCK_DEV SEMICOLON
70 current_drv
->dev_type
= block_dev
;
72 | DEV_TYPE EQUALS CHAR_DEV SEMICOLON
74 current_drv
->dev_type
= char_dev
;
76 | UPSCRIPT EQUALS STRING SEMICOLON
78 current_drv
->upscript
= $3;
80 | DOWNSCRIPT EQUALS STRING SEMICOLON
82 current_drv
->downscript
= $3;
86 usb_device_id_statements:
87 usb_device_id_statement
90 |usb_device_id_statements usb_device_id_statement
95 usb_device_id_statement:
96 INTERFACE_CLASS EQUALS STRING SEMICOLON
100 current_id
->match_flags |
= USB_MATCH_INTERFACE_CLASS
;
101 res
= sscanf
($3, "0x%x", &num
);
103 fprintf
(stderr
, "ERROR");
106 current_id
->match_id.bInterfaceClass
= num
;
108 | INTERFACE_SUB_CLASS EQUALS STRING SEMICOLON
112 current_id
->match_flags |
= USB_MATCH_INTERFACE_SUBCLASS
;
113 res
= sscanf
($3, "0x%x", &num
);
115 fprintf
(stderr
, "ERROR");
118 current_id
->match_id.bInterfaceSubClass
= num
;
121 | INTERFACE_PROTOCOL EQUALS STRING SEMICOLON
125 current_id
->match_flags |
= USB_MATCH_INTERFACE_PROTOCOL
;
126 res
= sscanf
($3, "0x%x", &num
);
128 fprintf
(stderr
, "ERROR");
131 current_id
->match_id.bInterfaceProtocol
= num
;