? ffoo ? o ? usb.diff ? usb_dev.c ? usb_dev.h ? usb_device.c ? usb_device.h ? usb_generic.c ? usb_generic.h ? usb_ioctl.h Index: ugen.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/ugen.c,v retrieving revision 1.172 diff -u -p -u -r1.172 ugen.c --- ugen.c 20 Jul 2023 20:00:34 -0000 1.172 +++ ugen.c 28 Jul 2023 20:27:12 -0000 @@ -1657,11 +1657,37 @@ ugen_get_alt_index(struct ugen_softc *sc return usbd_get_interface_altindex(iface); } +static int +ugen_set_short_transfer(struct ugen_endpoint *sce, void *addr) +{ + if (sce == NULL || sce->pipeh == NULL) + return EINVAL; + if (*(int *)addr) + sce->state |= UGEN_SHORT_OK; + else + sce->state &= ~UGEN_SHORT_OK; + DPRINTFN(5, "pipe=%jx short xfer=%ju", + (uintptr_t)sce->pipeh, sce->state & UGEN_SHORT_OK, 0, 0); + return 0; +} + +static int +ugen_set_timeout(struct ugen_endpoint *sce, void *addr) + if (sce == NULL) + return EINVAL; + + sce->timeout = *(int *)addr; + DPRINTFN(5, "pipe=%jx timeout[dir=%ju] timeout=%ju", + (uintptr_t)sce->pipeh, dir, sce->timeout, 0); +} + + Static int ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, void *addr, int flag, struct lwp *l) { struct ugen_endpoint *sce; + struct ugen_endpoint *rxe, *txe; usbd_status err; struct usbd_interface *iface; struct usb_config_desc *cd; @@ -1683,35 +1709,40 @@ ugen_do_ioctl(struct ugen_softc *sc, int KASSERT(KERNEL_LOCKED_P()); /* ugen_set_config */ + rxe = &sc->sc_endpoints[endpt][IN]; + txe = &sc->sc_endpoints[endpt][OUT]; + switch (cmd) { case FIONBIO: /* All handled in the upper FS layer. */ return 0; case USB_SET_SHORT_XFER: + case USB_SET_RX_SHORT_XFER: if (endpt == USB_CONTROL_ENDPOINT) return EINVAL; /* This flag only affects read */ - sce = &sc->sc_endpoints[endpt][IN]; - if (sce == NULL || sce->pipeh == NULL) + return ugen_set_short_transfer(rxe, addr); + case USB_SET_TX_SHORT_XFER: + if (endpt == USB_CONTROL_ENDPOINT) return EINVAL; - if (*(int *)addr) - sce->state |= UGEN_SHORT_OK; - else - sce->state &= ~UGEN_SHORT_OK; - DPRINTFN(5, "pipe=%jx short xfer=%ju", - (uintptr_t)sce->pipeh, sce->state & UGEN_SHORT_OK, 0, 0); - return 0; + /* This flag only affects write */ + return ugen_set_short_transfer(&txe, addr); case USB_SET_TIMEOUT: for (dir = OUT; dir <= IN; dir++) { - sce = &sc->sc_endpoints[endpt][dir]; - if (sce == NULL) - return EINVAL; - - sce->timeout = *(int *)addr; - DPRINTFN(5, "pipe=%jx timeout[dir=%ju] timeout=%ju", - (uintptr_t)sce->pipeh, dir, sce->timeout, 0); + error = usen_set_timeout(&sc->sc_endpoints[endpt][dir], + addr); + if (error) + return error; } return 0; + case USB_SET_RX_TIMEOUT: + if (flags & FREAD) + return ugen_set_timeout(&rxe, addr); + return EINVAL; + case USB_SET_TX_TIMEOUT: + if (flags & FWRITE) + return ugen_set_timeout(&txe, addr); + return EINVAL; case USB_SET_BULK_RA: if (endpt == USB_CONTROL_ENDPOINT) return EINVAL; @@ -2068,11 +2099,22 @@ ugen_do_ioctl(struct ugen_softc *sc, int usbd_fill_deviceinfo(sc->sc_udev, (struct usb_device_info *)addr, 0); break; - case USB_GET_DEVICEINFO_OLD: + case USB_GET_DEVICEINFO30: + { + int ret; + MODULE_HOOK_CALL(usb_subr_fill_30_hook, + (sc->sc_udev, (struct usb_device_info30 *)addr, 0, + usbd_devinfo_vp, usbd_printBCD), + enosys(), ret); + if (ret == 0) + return 0; + return EINVAL; + } + case USB_GET_DEVICEINFO100: { int ret; MODULE_HOOK_CALL(usb_subr_fill_30_hook, - (sc->sc_udev, (struct usb_device_info_old *)addr, 0, + (sc->sc_udev, (struct usb_device_info30 *)addr, 0, usbd_devinfo_vp, usbd_printBCD), enosys(), ret); if (ret == 0) Index: uhid.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/uhid.c,v retrieving revision 1.127 diff -u -p -u -r1.127 uhid.c --- uhid.c 28 Mar 2023 20:01:58 -0000 1.127 +++ uhid.c 28 Jul 2023 20:27:12 -0000 @@ -663,15 +663,23 @@ uhidioctl(dev_t dev, u_long cmd, void *a usbd_fill_deviceinfo(sc->sc_udev, (struct usb_device_info *)addr, 0); break; - case USB_GET_DEVICEINFO_OLD: + case USB_GET_DEVICEINFO30: MODULE_HOOK_CALL(usb_subr_fill_30_hook, (sc->sc_udev, - (struct usb_device_info_old *)addr, 0, + (struct usb_device_info30 *)addr, 0, usbd_devinfo_vp, usbd_printBCD), enosys(), err); if (err == 0) return 0; break; + case USB_GET_DEVICEINFO100: + MODULE_HOOK_CALL(usb_subr_fill_100_hook, + (sc->sc_udev, + (struct usb_device_info100 *)addr, 0, + usbd_devinfo_vp, usbd_printBCD), + enosys(), err); + if (err == 0) + return 0; case USB_GET_STRING_DESC: { struct usb_string_desc *si = (struct usb_string_desc *)addr; Index: usb.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/usb.c,v retrieving revision 1.201 diff -u -p -u -r1.201 usb.c --- usb.c 20 Jul 2023 20:00:34 -0000 1.201 +++ usb.c 28 Jul 2023 20:27:13 -0000 @@ -857,17 +857,18 @@ int usbread(dev_t dev, struct uio *uio, int flag) { struct usb_event *ue; - struct usb_event_old *ueo = NULL; /* XXXGCC */ - int useold = 0; + void *ueo = NULL; /* XXXGCC */ + int esize = 0; int error, n; if (minor(dev) != USB_DEV_MINOR) return ENXIO; - switch (uio->uio_resid) { - case sizeof(struct usb_event_old): - ueo = kmem_zalloc(sizeof(struct usb_event_old), KM_SLEEP); - useold = 1; + switch (esize = uio->uio_resid) { + case sizeof(struct usb_event100): + case sizeof(struct usb_event30): + /* big enough */ + ueo = kmem_zalloc(sizeof(struct usb_event100), KM_SLEEP); /* FALLTHROUGH */ case sizeof(struct usb_event): ue = usb_alloc_event(); @@ -892,20 +893,29 @@ usbread(dev_t dev, struct uio *uio, int } mutex_exit(&usb_event_lock); if (!error) { - if (useold) { /* copy fields to old struct */ + switch (esize) { + case sizeof(struct usb_event100): + MODULE_HOOK_CALL(usb_subr_copy_100_hook, + (ue, ueo, uio), enosys(), error); + if (error == ENOSYS) + error = EINVAL; + break; + case sizeof(struct usb_event30): MODULE_HOOK_CALL(usb_subr_copy_30_hook, (ue, ueo, uio), enosys(), error); if (error == ENOSYS) error = EINVAL; + break; + } - if (!error) - error = uiomove((void *)ueo, sizeof(*ueo), uio); - } else - error = uiomove((void *)ue, sizeof(*ue), uio); + if (!error) + error = uiomove(ueo, sizeof(*ueo), uio); + else + error = uiomove(ue, sizeof(*ue), uio); } usb_free_event(ue); if (ueo) - kmem_free(ueo, sizeof(struct usb_event_old)); + kmem_free(ueo, sizeof(struct usb_event100)); return error; } @@ -1056,10 +1066,10 @@ usbioctl(dev_t devt, u_long cmd, void *d break; } - case USB_DEVICEINFO_OLD: + case USB_DEVICEINFO30: { struct usbd_device *dev; - struct usb_device_info_old *di = (void *)data; + struct usb_device_info30 *di = (void *)data; int addr = di->udi_addr; if (addr < 1 || addr >= USB_MAX_DEVICES) { Index: usb.h =================================================================== RCS file: /cvsroot/src/sys/dev/usb/usb.h,v retrieving revision 1.121 diff -u -p -u -r1.121 usb.h --- usb.h 16 Sep 2022 07:35:44 -0000 1.121 +++ usb.h 28 Jul 2023 20:27:13 -0000 @@ -63,6 +63,23 @@ #define USB_FRAMES_PER_SECOND 1000 #define USB_UFRAMES_PER_FRAME 8 +#define USB_GENERIC_NAME "ugen" +#define USB_DEVICE_NAME "usbctl" + +/* + * Minimum time a device needs to be powered down to go through a + * power cycle. These values are not in the USB specification. + */ +#define USB_POWER_DOWN_TIME 200 /* ms */ +#define USB_PORT_POWER_DOWN_TIME 100 /* ms */ + +/* Definition of software USB power modes */ +#define USB_POWER_MODE_OFF 0 /* turn off device */ +#define USB_POWER_MODE_ON 1 /* always on */ +#define USB_POWER_MODE_SAVE 2 /* automatic suspend and resume */ +#define USB_POWER_MODE_SUSPEND 3 /* force suspend */ +#define USB_POWER_MODE_RESUME 4 /* force resume */ + /* * The USB records contain some unaligned little-endian word * components. The U[SG]ETW macros take care of both the alignment @@ -86,7 +103,7 @@ typedef uint8_t uDWord[4]; (w)[3] = (uint8_t)((v) >> 24)) #define UPACKED __packed -typedef struct { +typedef struct usb_device_request { uByte bmRequestType; uByte bRequest; uWord wValue; @@ -94,6 +111,163 @@ typedef struct { uWord wLength; } UPACKED usb_device_request_t; +struct usb_read_dir { + void *urd_data; + uint32_t urd_startentry; + uint32_t urd_maxlen; +}; + +struct usb_gen_descriptor { + void *ugd_data; + uint16_t ugd_lang_id; + uint16_t ugd_maxlen; + uint16_t ugd_actlen; + uint16_t ugd_offset; + uint8_t ugd_config_index; + uint8_t ugd_string_index; + uint8_t ugd_iface_index; + uint8_t ugd_altif_index; + uint8_t ugd_endpt_index; + uint8_t ugd_report_type; + uint8_t reserved[8]; +}; + +struct usb_device_info { + uint16_t udi_productNo; + uint16_t udi_vendorNo; + uint16_t udi_releaseNo; + uint16_t udi_power; /* power consumption in mA, 0 if + * selfpowered */ + uint8_t udi_bus; + uint8_t udi_addr; /* device address */ + uint8_t udi_index; /* device index */ + uint8_t udi_class; + uint8_t udi_subclass; + uint8_t udi_protocol; + uint8_t udi_config_no; /* current config number */ + uint8_t udi_config_index; /* current config index */ + uint8_t udi_speed; /* see "USB_SPEED_XXX" */ + uint8_t udi_mode; /* see "USB_MODE_XXX" */ +#define USB_MODE_HOST 1 /* initiates transfers */ +#define USB_MODE_DEVICE 2 /* bus transfer target */ +#define USB_MODE_DUAL 3 /* can be host or device */ + uint8_t udi_nports; + uint8_t udi_hubaddr; /* parent HUB address */ + uint8_t udi_hubindex; /* parent HUB device index */ + uint8_t udi_hubport; /* parent HUB port */ + uint8_t udi_power_mode; /* see "USB_POWER_MODE_XXX" */ + uint8_t udi_suspended; /* set if device is suspended */ + uint8_t udi_reserved[16]; /* leave space for the future */ + char udi_product[USB_MAX_ENCODED_STRING_LEN]; + char udi_vendor[USB_MAX_ENCODED_STRING_LEN]; + char udi_serial[USB_MAX_ENCODED_STRING_LEN]; + char udi_release[8]; +}; + +#define USB_DEVICE_PORT_PATH_MAX 32 + +struct usb_device_port_path { + uint8_t udp_bus; /* which bus we are on */ + uint8_t udp_index; /* which device index */ + uint8_t udp_port_level; /* how many levels: 0, 1, 2 ... */ + uint8_t udp_port_no[USB_DEVICE_PORT_PATH_MAX]; +}; + +struct usb_device_stats { + uint32_t uds_requests_ok[4]; /* Indexed by transfer type UE_XXX */ + uint32_t uds_requests_fail[4]; /* Indexed by transfer type UE_XXX */ +}; + +struct usb_fs_start { + uint8_t ep_index; +}; + +struct usb_fs_stop { + uint8_t ep_index; +}; + +struct usb_fs_complete { + uint8_t ep_index; +}; + +/* This structure is used for all endpoint types */ +struct usb_fs_endpoint { + /* + * NOTE: isochronous USB transfer only use one buffer, but can have + * multiple frame lengths ! + */ + void **ppBuffer; /* pointer to userland buffers */ + uint32_t *pLength; /* pointer to frame lengths, updated + * to actual length */ + uint32_t nFrames; /* number of frames */ + uint32_t aFrames; /* actual number of frames */ + uint16_t flags; + /* a single short frame will terminate */ +#define USB_FS_FLAG_SINGLE_SHORT_OK 0x0001 + /* multiple short frames are allowed */ +#define USB_FS_FLAG_MULTI_SHORT_OK 0x0002 + /* all frame(s) transmitted are short terminated */ +#define USB_FS_FLAG_FORCE_SHORT 0x0004 + /* will do a clear-stall before xfer */ +#define USB_FS_FLAG_CLEAR_STALL 0x0008 + uint16_t timeout; /* in milliseconds */ + /* isocronous completion time in milliseconds - used for echo cancel */ + uint16_t isoc_time_complete; + /* timeout value for no timeout */ +#define USB_FS_TIMEOUT_NONE 0 + int status; /* see USB_ERR_XXX */ +}; + +struct usb_fs_init { + /* userland pointer to endpoints structure */ + struct usb_fs_endpoint *pEndpoints; + /* maximum number of endpoints */ + uint8_t ep_index_max; +}; + +struct usb_fs_uninit { + uint8_t dummy; /* zero */ +}; + +struct usb_fs_open { +#define USB_FS_MAX_BUFSIZE (1 << 25) /* 32 MBytes */ + uint32_t max_bufsize; +#define USB_FS_MAX_FRAMES (1U << 12) +#define USB_FS_MAX_FRAMES_PRE_SCALE (1U << 31) /* for ISOCHRONOUS transfers */ + uint32_t max_frames; /* read and write */ + uint16_t max_packet_length; /* read only */ + uint8_t dev_index; /* currently unused */ + uint8_t ep_index; + uint8_t ep_no; /* bEndpointNumber */ +}; + +struct usb_fs_open_stream { + struct usb_fs_open fs_open; + uint16_t stream_id; /* stream ID */ +}; + +struct usb_fs_close { + uint8_t ep_index; +}; + +struct usb_fs_clear_stall_sync { + uint8_t ep_index; +}; + +struct usb_gen_quirk { + uint16_t index; /* Quirk Index */ + uint16_t vid; /* Vendor ID */ + uint16_t pid; /* Product ID */ + uint16_t bcdDeviceLow; /* Low Device Revision */ + uint16_t bcdDeviceHigh; /* High Device Revision */ + uint16_t reserved[2]; + /* + * String version of quirk including terminating zero. See + * UQ_XXX in "usb_quirk.h". + */ + char quirkname[64 - 14]; +}; + #define UT_GET_DIR(a) ((a) & 0x80) #define UT_WRITE 0x00 #define UT_READ 0x80 @@ -216,7 +390,7 @@ typedef struct { #define USB_DESCRIPTOR_SIZE 2 __CTASSERT(sizeof(usb_descriptor_t) == USB_DESCRIPTOR_SIZE); -typedef struct { +typedef struct usb_device_descriptor { uByte bLength; uByte bDescriptorType; uWord bcdUSB; @@ -239,15 +413,17 @@ typedef struct { } UPACKED usb_device_descriptor_t; #define USB_DEVICE_DESCRIPTOR_SIZE 18 -typedef struct { +typedef struct usb_config_descriptor { uByte bLength; uByte bDescriptorType; uWord wTotalLength; uByte bNumInterface; uByte bConfigurationValue; +#define USB_UNCONFIG_NO 0 uByte iConfiguration; uByte bmAttributes; -#define UC_ATTR_MBO 0x80 +#define UC_BUS_POWERED 0x80 +#define UC_ATTR_MBO UC_BUS_POWERED #define UC_SELF_POWERED 0x40 #define UC_REMOTE_WAKEUP 0x20 uByte bMaxPower; /* max current in 2 mA units */ @@ -794,6 +970,22 @@ typedef struct { #define USB_BUS_RESET_DELAY 100 /* ms XXX?*/ +/* + * USB record layout in memory: + * + * - USB config 0 + * - USB interfaces + * - USB alternative interfaces + * - USB endpoints + * + * - USB config 1 + * - USB interfaces + * - USB alternative interfaces + * - USB endpoints + */ + +/* Declaration of USB records */ + #define USB_UNCONFIG_NO 0 #define USB_UNCONFIG_INDEX (-1) @@ -880,7 +1072,7 @@ typedef struct { uint32_t cookie; } usb_ #define USB_MAX_DEVNAMES 4 #define USB_MAX_DEVNAMELEN 16 -struct usb_device_info { +struct usb_device_info100 { uint8_t udi_bus; uint8_t udi_addr; /* device address */ usb_event_cookie_t udi_cookie; @@ -901,6 +1093,7 @@ struct usb_device_info { #define USB_SPEED_HIGH 3 #define USB_SPEED_SUPER 4 #define USB_SPEED_SUPER_PLUS 5 +#define USB_SPEED_VARIABLE 6 #define USB_IS_SS(X) ((X) == USB_SPEED_SUPER || (X) == USB_SPEED_SUPER_PLUS) int udi_power; /* power consumption in mA, 0 if selfpowered */ int udi_nports; @@ -912,8 +1105,9 @@ struct usb_device_info { #define USB_PORT_DISABLED 0xfc }; + /* <=3.0 had this layout of the structure */ -struct usb_device_info_old { +struct usb_device_info30 { uint8_t udi_bus; uint8_t udi_addr; /* device address */ usb_event_cookie_t udi_cookie; @@ -939,7 +1133,7 @@ struct usb_ctl_report { unsigned char ucr_data[1024]; /* filled data size will vary */ }; -struct usb_device_stats { +struct usb_device_stats100 { unsigned long uds_requests[4]; /* indexed by transfer type UE_* */ }; @@ -973,14 +1167,14 @@ struct usb_event { }; /* old <=3.0 compat event */ -struct usb_event_old { +struct usb_event30 { int ue_type; struct timespec ue_time; union { struct { int ue_bus; } ue_ctrlr; - struct usb_device_info_old ue_device; + struct usb_device_info30 ue_device; struct { usb_event_cookie_t ue_cookie; char ue_devname[16]; @@ -994,8 +1188,11 @@ struct usb_event_old { #define USB_SETDEBUG _IOW ('U', 2, int) #define USB_DISCOVER _IO ('U', 3) #define USB_DEVICEINFO _IOWR('U', 4, struct usb_device_info) -#define USB_DEVICEINFO_OLD _IOWR('U', 4, struct usb_device_info_old) +#define USB_DEVICEINFO_30 _IOWR('U', 4, struct usb_device_info30) +#define USB_DEVICEINFO_100 _IOWR('U', 4, struct usb_device_info100) #define USB_DEVICESTATS _IOR ('U', 5, struct usb_device_stats) +#define USB_DEVICESTATS _IOR ('U', 5, struct usb_device_stats100) +#define USB_DEVICEENUMERATE _IOW ('U', 6, int) /* Generic HID device */ #define USB_GET_REPORT_DESC _IOR ('U', 21, struct usb_ctl_report_desc) @@ -1018,16 +1215,63 @@ struct usb_event_old { #define USB_GET_STRING_DESC _IOWR('U', 110, struct usb_string_desc) #define USB_DO_REQUEST _IOWR('U', 111, struct usb_ctl_request) #define USB_GET_DEVICEINFO _IOR ('U', 112, struct usb_device_info) -#define USB_GET_DEVICEINFO_OLD _IOR ('U', 112, struct usb_device_info_old) +#define USB_GET_DEVICEINFO30 _IOR ('U', 112, struct usb_device_info30) +#define USB_GET_DEVICEINFO100 _IOR ('U', 112, struct usb_device_info100) #define USB_SET_SHORT_XFER _IOW ('U', 113, int) #define USB_SET_TIMEOUT _IOW ('U', 114, int) #define USB_SET_BULK_RA _IOW ('U', 115, int) #define USB_SET_BULK_WB _IOW ('U', 116, int) #define USB_SET_BULK_RA_OPT _IOW ('U', 117, struct usb_bulk_ra_wb_opt) #define USB_SET_BULK_WB_OPT _IOW ('U', 118, struct usb_bulk_ra_wb_opt) +#define USB_SET_RX_STALL_FLAG _IOW ('U', 119, int) +#define USB_SET_TX_STALL_FLAG _IOW ('U', 120, int) +#define USB_GET_IFACE_DRIVER _IOWR('U', 121, struct usb_gen_descriptor) +#define USB_CLAIM_INTERFACE _IOW ('U', 122, int) +#define USB_RELEASE_INTERFACE _IOW ('U', 123, int) +#define USB_IFACE_DRIVER_ACTIVE _IOW ('U', 124, int) +#define USB_IFACE_DRIVER_DETACH _IOW ('U', 125, int) +#define USB_GET_PLUGTIME _IOR ('U', 126, uint32_t) +#define USB_READ_DIR _IOW ('U', 127, struct usb_read_dir) +/* 128 - 133 unused, XXX 130,131 used */ +#define USB_GET_DEV_PORT_PATH _IOR ('U', 134, struct usb_device_port_path) +#define USB_GET_POWER_USAGE _IOR ('U', 135, int) +#define USB_SET_TX_FORCE_SHORT _IOW ('U', 136, int) +#define USB_SET_TX_TIMEOUT _IOW ('U', 137, int) +#define USB_GET_TX_FRAME_SIZE _IOR ('U', 138, int) +#define USB_GET_TX_BUFFER_SIZE _IOR ('U', 139, int) +#define USB_SET_TX_BUFFER_SIZE _IOW ('U', 140, int) +#define USB_GET_TX_INTERFACE_DESC _IOR ('U', 141, struct usb_interface_descriptor) +#define USB_GET_TX_ENDPOINT_DESC _IOR ('U', 142, struct usb_endpoint_descriptor) +#define USB_SET_PORT_ENABLE _IOW ('U', 143, int) +#define USB_SET_PORT_DISABLE _IOW ('U', 144, int) +#define USB_SET_POWER_MODE _IOW ('U', 145, int) +#define USB_GET_POWER_MODE _IOR ('U', 146, int) +#define USB_SET_TEMPLATE _IOW ('U', 147, int) +#define USB_GET_TEMPLATE _IOR ('U', 148, int) -/* Modem device */ +/* Modem device, XXX: out of order for compat */ #define USB_GET_CM_OVER_DATA _IOR ('U', 130, int) #define USB_SET_CM_OVER_DATA _IOW ('U', 131, int) +/* GPIO control */ +#define USB_GET_GPIO _IOR ('U', 182, int) +#define USB_SET_GPIO _IOW ('U', 183, int) + +/* USB file system interface */ +#define USB_FS_START _IOW ('U', 192, struct usb_fs_start) +#define USB_FS_STOP _IOW ('U', 193, struct usb_fs_stop) +#define USB_FS_COMPLETE _IOR ('U', 194, struct usb_fs_complete) +#define USB_FS_INIT _IOW ('U', 195, struct usb_fs_init) +#define USB_FS_UNINIT _IOW ('U', 196, struct usb_fs_uninit) +#define USB_FS_OPEN _IOWR('U', 197, struct usb_fs_open) +#define USB_FS_CLOSE _IOW ('U', 198, struct usb_fs_close) +#define USB_FS_CLEAR_STALL_SYNC _IOW ('U', 199, struct usb_fs_clear_stall_sync) +#define USB_FS_OPEN_STREAM _IOWR('U', 200, struct usb_fs_open_stream) + +/* USB quirk system interface */ +#define USB_DEV_QUIRK_GET _IOWR('Q', 0, struct usb_gen_quirk) +#define USB_QUIRK_NAME_GET _IOWR('Q', 1, struct usb_gen_quirk) +#define USB_DEV_QUIRK_ADD _IOW ('Q', 2, struct usb_gen_quirk) +#define USB_DEV_QUIRK_REMOVE _IOW ('Q', 3, struct usb_gen_quirk) + #endif /* _USB_H_ */ Index: usbdi.h =================================================================== RCS file: /cvsroot/src/sys/dev/usb/usbdi.h,v retrieving revision 1.108 diff -u -p -u -r1.108 usbdi.h --- usbdi.h 20 Aug 2022 11:32:20 -0000 1.108 +++ usbdi.h 28 Jul 2023 20:27:13 -0000 @@ -91,6 +91,8 @@ typedef void (*usbd_callback)(struct usb #define DEVINFOSIZE 1024 +#ifdef _KERNEL + usbd_status usbd_open_pipe_intr(struct usbd_interface *, uint8_t, uint8_t, struct usbd_pipe **, void *, void *, uint32_t, usbd_callback, int); usbd_status usbd_open_pipe(struct usbd_interface *, uint8_t, uint8_t, @@ -316,4 +318,6 @@ struct usbif_attach_arg { #define IPL_SOFTUSB IPL_SOFTSERIAL #define splusb splsoftserial +#endif + #endif /* _USBDI_H_ */