xref: /minix3/minix/commands/devmand/usb_driver.h (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc #ifndef DEVMAN_USB_DRIVER
2*433d6423SLionel Sambuc #define DEVMAN_USB_DRIVER
3*433d6423SLionel Sambuc 
4*433d6423SLionel Sambuc #include <minix/usb.h>
5*433d6423SLionel Sambuc #include <sys/queue.h>
6*433d6423SLionel Sambuc 
7*433d6423SLionel Sambuc #define USB_MATCH_ID_VENDOR          (1 << 0)
8*433d6423SLionel Sambuc #define USB_MATCH_ID_PRODUCT         (1 << 1)
9*433d6423SLionel Sambuc #define USB_MATCH_BCD_DEVICE         (1 << 2)
10*433d6423SLionel Sambuc #define USB_MATCH_DEVICE_CLASS       (1 << 3)
11*433d6423SLionel Sambuc #define USB_MATCH_DEVICE_SUBCLASS    (1 << 4)
12*433d6423SLionel Sambuc #define USB_MATCH_DEVICE_PROTOCOL    (1 << 5)
13*433d6423SLionel Sambuc #define USB_MATCH_INTERFACE_CLASS    (1 << 6)
14*433d6423SLionel Sambuc #define USB_MATCH_INTERFACE_SUBCLASS (1 << 7)
15*433d6423SLionel Sambuc #define USB_MATCH_INTERFACE_PROTOCOL (1 << 8)
16*433d6423SLionel Sambuc 
17*433d6423SLionel Sambuc enum devmand_device_type {
18*433d6423SLionel Sambuc 	char_dev,
19*433d6423SLionel Sambuc 	block_dev
20*433d6423SLionel Sambuc };
21*433d6423SLionel Sambuc 
22*433d6423SLionel Sambuc struct devmand_usb_match_id {
23*433d6423SLionel Sambuc 	unsigned match_flags;
24*433d6423SLionel Sambuc 	struct usb_device_id match_id;
25*433d6423SLionel Sambuc 	LIST_ENTRY(devmand_usb_match_id) list;
26*433d6423SLionel Sambuc };
27*433d6423SLionel Sambuc 
28*433d6423SLionel Sambuc #define DEVMAND_DRIVER_LABEL_LEN 32
29*433d6423SLionel Sambuc 
30*433d6423SLionel Sambuc struct devmand_driver_instance {
31*433d6423SLionel Sambuc 	int dev_id;
32*433d6423SLionel Sambuc 	int major;
33*433d6423SLionel Sambuc 	char label[DEVMAND_DRIVER_LABEL_LEN];
34*433d6423SLionel Sambuc 	struct devmand_usb_driver *drv;
35*433d6423SLionel Sambuc 	LIST_ENTRY(devmand_driver_instance) list;
36*433d6423SLionel Sambuc };
37*433d6423SLionel Sambuc 
38*433d6423SLionel Sambuc struct devmand_usb_driver {
39*433d6423SLionel Sambuc 	char *name;
40*433d6423SLionel Sambuc 	char *devprefix;
41*433d6423SLionel Sambuc 	char *binary;
42*433d6423SLionel Sambuc 	char *upscript;
43*433d6423SLionel Sambuc 	char *downscript;
44*433d6423SLionel Sambuc 	enum devmand_device_type dev_type;
45*433d6423SLionel Sambuc 	LIST_HEAD(devid_head, devmand_usb_match_id) ids;
46*433d6423SLionel Sambuc 	LIST_ENTRY(devmand_usb_driver) list;
47*433d6423SLionel Sambuc };
48*433d6423SLionel Sambuc 
49*433d6423SLionel Sambuc struct devmand_usb_driver * add_usb_driver(char *name);
50*433d6423SLionel Sambuc struct devmand_usb_match_id *add_usb_match_id(struct devmand_usb_driver *drv);
51*433d6423SLionel Sambuc 
52*433d6423SLionel Sambuc #endif
53