34#ifndef USB_GLOBAL_INCLUDE_FILE
35#include <sys/ioccom.h>
44#define USB_DEVICE_NAME "usbctl"
45#define USB_DEVICE_DIR "usb"
46#define USB_GENERIC_NAME "ugen"
47#define USB_TEMPLATE_SYSCTL "hw.usb.template"
130#define USB_DEVICE_PORT_PATH_MAX 32
169#define USB_FS_FLAG_SINGLE_SHORT_OK 0x0001
171#define USB_FS_FLAG_MULTI_SHORT_OK 0x0002
173#define USB_FS_FLAG_FORCE_SHORT 0x0004
175#define USB_FS_FLAG_CLEAR_STALL 0x0008
180#define USB_FS_TIMEOUT_NONE 0
196#define USB_FS_MAX_BUFSIZE (1 << 25)
198#define USB_FS_MAX_FRAMES (1U << 12)
199#define USB_FS_MAX_FRAMES_PRE_SCALE (1U << 31)
235#define USB_REQUEST _IOWR('U', 1, struct usb_ctl_request)
236#define USB_SETDEBUG _IOW ('U', 2, int)
237#define USB_DISCOVER _IO ('U', 3)
238#define USB_DEVICEINFO _IOWR('U', 4, struct usb_device_info)
239#define USB_DEVICESTATS _IOR ('U', 5, struct usb_device_stats)
240#define USB_DEVICEENUMERATE _IOW ('U', 6, int)
243#define USB_GET_REPORT_DESC _IOWR('U', 21, struct usb_gen_descriptor)
244#define USB_SET_IMMED _IOW ('U', 22, int)
245#define USB_GET_REPORT _IOWR('U', 23, struct usb_gen_descriptor)
246#define USB_SET_REPORT _IOW ('U', 24, struct usb_gen_descriptor)
247#define USB_GET_REPORT_ID _IOR ('U', 25, int)
250#define USB_GET_CONFIG _IOR ('U', 100, int)
251#define USB_SET_CONFIG _IOW ('U', 101, int)
252#define USB_GET_ALTINTERFACE _IOWR('U', 102, struct usb_alt_interface)
253#define USB_SET_ALTINTERFACE _IOWR('U', 103, struct usb_alt_interface)
254#define USB_GET_DEVICE_DESC _IOR ('U', 105, struct usb_device_descriptor)
255#define USB_GET_CONFIG_DESC _IOR ('U', 106, struct usb_config_descriptor)
256#define USB_GET_RX_INTERFACE_DESC _IOR ('U', 107, struct usb_interface_descriptor)
257#define USB_GET_RX_ENDPOINT_DESC _IOR ('U', 108, struct usb_endpoint_descriptor)
258#define USB_GET_FULL_DESC _IOWR('U', 109, struct usb_gen_descriptor)
259#define USB_GET_STRING_DESC _IOWR('U', 110, struct usb_gen_descriptor)
260#define USB_DO_REQUEST _IOWR('U', 111, struct usb_ctl_request)
261#define USB_GET_DEVICEINFO _IOR ('U', 112, struct usb_device_info)
262#define USB_SET_RX_SHORT_XFER _IOW ('U', 113, int)
263#define USB_SET_RX_TIMEOUT _IOW ('U', 114, int)
264#define USB_GET_RX_FRAME_SIZE _IOR ('U', 115, int)
265#define USB_GET_RX_BUFFER_SIZE _IOR ('U', 117, int)
266#define USB_SET_RX_BUFFER_SIZE _IOW ('U', 118, int)
267#define USB_SET_RX_STALL_FLAG _IOW ('U', 119, int)
268#define USB_SET_TX_STALL_FLAG _IOW ('U', 120, int)
269#define USB_GET_IFACE_DRIVER _IOWR('U', 121, struct usb_gen_descriptor)
270#define USB_CLAIM_INTERFACE _IOW ('U', 122, int)
271#define USB_RELEASE_INTERFACE _IOW ('U', 123, int)
272#define USB_IFACE_DRIVER_ACTIVE _IOW ('U', 124, int)
273#define USB_IFACE_DRIVER_DETACH _IOW ('U', 125, int)
274#define USB_GET_PLUGTIME _IOR ('U', 126, uint32_t)
275#define USB_READ_DIR _IOW ('U', 127, struct usb_read_dir)
277#define USB_GET_DEV_PORT_PATH _IOR ('U', 134, struct usb_device_port_path)
278#define USB_GET_POWER_USAGE _IOR ('U', 135, int)
279#define USB_SET_TX_FORCE_SHORT _IOW ('U', 136, int)
280#define USB_SET_TX_TIMEOUT _IOW ('U', 137, int)
281#define USB_GET_TX_FRAME_SIZE _IOR ('U', 138, int)
282#define USB_GET_TX_BUFFER_SIZE _IOR ('U', 139, int)
283#define USB_SET_TX_BUFFER_SIZE _IOW ('U', 140, int)
284#define USB_GET_TX_INTERFACE_DESC _IOR ('U', 141, struct usb_interface_descriptor)
285#define USB_GET_TX_ENDPOINT_DESC _IOR ('U', 142, struct usb_endpoint_descriptor)
286#define USB_SET_PORT_ENABLE _IOW ('U', 143, int)
287#define USB_SET_PORT_DISABLE _IOW ('U', 144, int)
288#define USB_SET_POWER_MODE _IOW ('U', 145, int)
289#define USB_GET_POWER_MODE _IOR ('U', 146, int)
290#define USB_SET_TEMPLATE _IOW ('U', 147, int)
291#define USB_GET_TEMPLATE _IOR ('U', 148, int)
294#define USB_GET_CM_OVER_DATA _IOR ('U', 180, int)
295#define USB_SET_CM_OVER_DATA _IOW ('U', 181, int)
298#define USB_GET_GPIO _IOR ('U', 182, int)
299#define USB_SET_GPIO _IOW ('U', 183, int)
302#define USB_FS_START _IOW ('U', 192, struct usb_fs_start)
303#define USB_FS_STOP _IOW ('U', 193, struct usb_fs_stop)
304#define USB_FS_COMPLETE _IOR ('U', 194, struct usb_fs_complete)
305#define USB_FS_INIT _IOW ('U', 195, struct usb_fs_init)
306#define USB_FS_UNINIT _IOW ('U', 196, struct usb_fs_uninit)
307#define USB_FS_OPEN _IOWR('U', 197, struct usb_fs_open)
308#define USB_FS_CLOSE _IOW ('U', 198, struct usb_fs_close)
309#define USB_FS_CLEAR_STALL_SYNC _IOW ('U', 199, struct usb_fs_clear_stall_sync)
310#define USB_FS_OPEN_STREAM _IOWR('U', 200, struct usb_fs_open_stream)
313#define USB_DEV_QUIRK_GET _IOWR('Q', 0, struct usb_gen_quirk)
314#define USB_QUIRK_NAME_GET _IOWR('Q', 1, struct usb_gen_quirk)
315#define USB_DEV_QUIRK_ADD _IOW ('Q', 2, struct usb_gen_quirk)
316#define USB_DEV_QUIRK_REMOVE _IOW ('Q', 3, struct usb_gen_quirk)
319#ifdef COMPAT_FREEBSD32
321struct usb_read_dir32 {
323 uint32_t urd_startentry;
326#define USB_READ_DIR32 \
327 _IOC_NEWTYPE(USB_READ_DIR, struct usb_read_dir32)
329struct usb_ctl_request32 {
336#define USB_REQUEST32 _IOC_NEWTYPE(USB_REQUEST, struct usb_ctl_request32)
337#define USB_DO_REQUEST32 _IOC_NEWTYPE(USB_DO_REQUEST, struct usb_ctl_request32)
339struct usb_gen_descriptor32 {
341 uint16_t ugd_lang_id;
345 uint8_t ugd_config_index;
346 uint8_t ugd_string_index;
347 uint8_t ugd_iface_index;
348 uint8_t ugd_altif_index;
349 uint8_t ugd_endpt_index;
350 uint8_t ugd_report_type;
354#define USB_GET_REPORT_DESC32 \
355 _IOC_NEWTYPE(USB_GET_REPORT_DESC, struct usb_gen_descriptor32)
356#define USB_GET_REPORT32 \
357 _IOC_NEWTYPE(USB_GET_REPORT, struct usb_gen_descriptor32)
358#define USB_SET_REPORT32 \
359 _IOC_NEWTYPE(USB_SET_REPORT, struct usb_gen_descriptor32)
360#define USB_GET_FULL_DESC32 \
361 _IOC_NEWTYPE(USB_GET_FULL_DESC, struct usb_gen_descriptor32)
362#define USB_GET_STRING_DESC32 \
363 _IOC_NEWTYPE(USB_GET_STRING_DESC, struct usb_gen_descriptor32)
364#define USB_GET_IFACE_DRIVER32 \
365 _IOC_NEWTYPE(USB_GET_IFACE_DRIVER, struct usb_gen_descriptor32)
368 const struct usb_gen_descriptor32 *ugd32);
369void update_usb_gen_descriptor32(
struct usb_gen_descriptor32 *ugd32,
372struct usb_fs_endpoint32 {
379 uint16_t isoc_time_complete;
383struct usb_fs_init32 {
385 uint8_t ep_index_max;
388#define USB_FS_INIT32 _IOC_NEWTYPE(USB_FS_INIT, struct usb_fs_init32)
uint8_t uai_interface_index
struct usb_device_request ucr_request
uint8_t udp_port_no[USB_DEVICE_PORT_PATH_MAX]
uint32_t uds_requests_fail[4]
uint32_t uds_requests_ok[4]
uint16_t isoc_time_complete
struct usb_fs_endpoint * pEndpoints
struct usb_fs_open fs_open
uint16_t max_packet_length
#define USB_DEVICE_PORT_PATH_MAX