1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2607ca46eSDavid Howells /*****************************************************************************/ 3607ca46eSDavid Howells 4607ca46eSDavid Howells /* 5607ca46eSDavid Howells * usbdevice_fs.h -- USB device file system. 6607ca46eSDavid Howells * 7607ca46eSDavid Howells * Copyright (C) 2000 8607ca46eSDavid Howells * Thomas Sailer (sailer@ife.ee.ethz.ch) 9607ca46eSDavid Howells * 10607ca46eSDavid Howells * This program is free software; you can redistribute it and/or modify 11607ca46eSDavid Howells * it under the terms of the GNU General Public License as published by 12607ca46eSDavid Howells * the Free Software Foundation; either version 2 of the License, or 13607ca46eSDavid Howells * (at your option) any later version. 14607ca46eSDavid Howells * 15607ca46eSDavid Howells * This program is distributed in the hope that it will be useful, 16607ca46eSDavid Howells * but WITHOUT ANY WARRANTY; without even the implied warranty of 17607ca46eSDavid Howells * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18607ca46eSDavid Howells * GNU General Public License for more details. 19607ca46eSDavid Howells * 20607ca46eSDavid Howells * You should have received a copy of the GNU General Public License 21607ca46eSDavid Howells * along with this program; if not, write to the Free Software 22607ca46eSDavid Howells * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23607ca46eSDavid Howells * 24607ca46eSDavid Howells * History: 25607ca46eSDavid Howells * 0.1 04.01.2000 Created 26607ca46eSDavid Howells */ 27607ca46eSDavid Howells 28607ca46eSDavid Howells /*****************************************************************************/ 29607ca46eSDavid Howells 30607ca46eSDavid Howells #ifndef _UAPI_LINUX_USBDEVICE_FS_H 31607ca46eSDavid Howells #define _UAPI_LINUX_USBDEVICE_FS_H 32607ca46eSDavid Howells 33607ca46eSDavid Howells #include <linux/types.h> 34607ca46eSDavid Howells #include <linux/magic.h> 35607ca46eSDavid Howells 36607ca46eSDavid Howells /* --------------------------------------------------------------------- */ 37607ca46eSDavid Howells 38607ca46eSDavid Howells /* usbdevfs ioctl codes */ 39607ca46eSDavid Howells 40607ca46eSDavid Howells struct usbdevfs_ctrltransfer { 41607ca46eSDavid Howells __u8 bRequestType; 42607ca46eSDavid Howells __u8 bRequest; 43607ca46eSDavid Howells __u16 wValue; 44607ca46eSDavid Howells __u16 wIndex; 45607ca46eSDavid Howells __u16 wLength; 46607ca46eSDavid Howells __u32 timeout; /* in milliseconds */ 47607ca46eSDavid Howells void __user *data; 48607ca46eSDavid Howells }; 49607ca46eSDavid Howells 50607ca46eSDavid Howells struct usbdevfs_bulktransfer { 51607ca46eSDavid Howells unsigned int ep; 52607ca46eSDavid Howells unsigned int len; 53607ca46eSDavid Howells unsigned int timeout; /* in milliseconds */ 54607ca46eSDavid Howells void __user *data; 55607ca46eSDavid Howells }; 56607ca46eSDavid Howells 57607ca46eSDavid Howells struct usbdevfs_setinterface { 58607ca46eSDavid Howells unsigned int interface; 59607ca46eSDavid Howells unsigned int altsetting; 60607ca46eSDavid Howells }; 61607ca46eSDavid Howells 62607ca46eSDavid Howells struct usbdevfs_disconnectsignal { 63607ca46eSDavid Howells unsigned int signr; 64607ca46eSDavid Howells void __user *context; 65607ca46eSDavid Howells }; 66607ca46eSDavid Howells 67607ca46eSDavid Howells #define USBDEVFS_MAXDRIVERNAME 255 68607ca46eSDavid Howells 69607ca46eSDavid Howells struct usbdevfs_getdriver { 70607ca46eSDavid Howells unsigned int interface; 71607ca46eSDavid Howells char driver[USBDEVFS_MAXDRIVERNAME + 1]; 72607ca46eSDavid Howells }; 73607ca46eSDavid Howells 74607ca46eSDavid Howells struct usbdevfs_connectinfo { 75607ca46eSDavid Howells unsigned int devnum; 76607ca46eSDavid Howells unsigned char slow; 77607ca46eSDavid Howells }; 78607ca46eSDavid Howells 79607ca46eSDavid Howells #define USBDEVFS_URB_SHORT_NOT_OK 0x01 80607ca46eSDavid Howells #define USBDEVFS_URB_ISO_ASAP 0x02 81607ca46eSDavid Howells #define USBDEVFS_URB_BULK_CONTINUATION 0x04 82*aa15d3d2SAlan Stern #define USBDEVFS_URB_NO_FSBR 0x20 /* Not used */ 83607ca46eSDavid Howells #define USBDEVFS_URB_ZERO_PACKET 0x40 84607ca46eSDavid Howells #define USBDEVFS_URB_NO_INTERRUPT 0x80 85607ca46eSDavid Howells 86607ca46eSDavid Howells #define USBDEVFS_URB_TYPE_ISO 0 87607ca46eSDavid Howells #define USBDEVFS_URB_TYPE_INTERRUPT 1 88607ca46eSDavid Howells #define USBDEVFS_URB_TYPE_CONTROL 2 89607ca46eSDavid Howells #define USBDEVFS_URB_TYPE_BULK 3 90607ca46eSDavid Howells 91607ca46eSDavid Howells struct usbdevfs_iso_packet_desc { 92607ca46eSDavid Howells unsigned int length; 93607ca46eSDavid Howells unsigned int actual_length; 94607ca46eSDavid Howells unsigned int status; 95607ca46eSDavid Howells }; 96607ca46eSDavid Howells 97607ca46eSDavid Howells struct usbdevfs_urb { 98607ca46eSDavid Howells unsigned char type; 99607ca46eSDavid Howells unsigned char endpoint; 100607ca46eSDavid Howells int status; 101607ca46eSDavid Howells unsigned int flags; 102607ca46eSDavid Howells void __user *buffer; 103607ca46eSDavid Howells int buffer_length; 104607ca46eSDavid Howells int actual_length; 105607ca46eSDavid Howells int start_frame; 106948cd8c1SHans de Goede union { 107948cd8c1SHans de Goede int number_of_packets; /* Only used for isoc urbs */ 108948cd8c1SHans de Goede unsigned int stream_id; /* Only used with bulk streams */ 109948cd8c1SHans de Goede }; 110607ca46eSDavid Howells int error_count; 111607ca46eSDavid Howells unsigned int signr; /* signal to be sent on completion, 112607ca46eSDavid Howells or 0 if none should be sent. */ 113607ca46eSDavid Howells void __user *usercontext; 114607ca46eSDavid Howells struct usbdevfs_iso_packet_desc iso_frame_desc[0]; 115607ca46eSDavid Howells }; 116607ca46eSDavid Howells 117607ca46eSDavid Howells /* ioctls for talking directly to drivers */ 118607ca46eSDavid Howells struct usbdevfs_ioctl { 119607ca46eSDavid Howells int ifno; /* interface 0..N ; negative numbers reserved */ 120607ca46eSDavid Howells int ioctl_code; /* MUST encode size + direction of data so the 121607ca46eSDavid Howells * macros in <asm/ioctl.h> give correct values */ 122607ca46eSDavid Howells void __user *data; /* param buffer (in, or out) */ 123607ca46eSDavid Howells }; 124607ca46eSDavid Howells 125607ca46eSDavid Howells /* You can do most things with hubs just through control messages, 126607ca46eSDavid Howells * except find out what device connects to what port. */ 127607ca46eSDavid Howells struct usbdevfs_hub_portinfo { 128607ca46eSDavid Howells char nports; /* number of downstream ports in this hub */ 129607ca46eSDavid Howells char port [127]; /* e.g. port 3 connects to device 27 */ 130607ca46eSDavid Howells }; 131607ca46eSDavid Howells 1323f2cee73SAlan Stern /* System and bus capability flags */ 133607ca46eSDavid Howells #define USBDEVFS_CAP_ZERO_PACKET 0x01 134607ca46eSDavid Howells #define USBDEVFS_CAP_BULK_CONTINUATION 0x02 135607ca46eSDavid Howells #define USBDEVFS_CAP_NO_PACKET_SIZE_LIM 0x04 136607ca46eSDavid Howells #define USBDEVFS_CAP_BULK_SCATTER_GATHER 0x08 1373f2cee73SAlan Stern #define USBDEVFS_CAP_REAP_AFTER_DISCONNECT 0x10 138f7d34b44SSteinar H. Gunderson #define USBDEVFS_CAP_MMAP 0x20 139d883f52eSReilly Grant #define USBDEVFS_CAP_DROP_PRIVILEGES 0x40 140607ca46eSDavid Howells 141607ca46eSDavid Howells /* USBDEVFS_DISCONNECT_CLAIM flags & struct */ 142607ca46eSDavid Howells 143607ca46eSDavid Howells /* disconnect-and-claim if the driver matches the driver field */ 144607ca46eSDavid Howells #define USBDEVFS_DISCONNECT_CLAIM_IF_DRIVER 0x01 145607ca46eSDavid Howells /* disconnect-and-claim except when the driver matches the driver field */ 146607ca46eSDavid Howells #define USBDEVFS_DISCONNECT_CLAIM_EXCEPT_DRIVER 0x02 147607ca46eSDavid Howells 148607ca46eSDavid Howells struct usbdevfs_disconnect_claim { 149607ca46eSDavid Howells unsigned int interface; 150607ca46eSDavid Howells unsigned int flags; 151607ca46eSDavid Howells char driver[USBDEVFS_MAXDRIVERNAME + 1]; 152607ca46eSDavid Howells }; 153607ca46eSDavid Howells 154bcf7f6e3SHans de Goede struct usbdevfs_streams { 155bcf7f6e3SHans de Goede unsigned int num_streams; /* Not used by USBDEVFS_FREE_STREAMS */ 156bcf7f6e3SHans de Goede unsigned int num_eps; 157bcf7f6e3SHans de Goede unsigned char eps[0]; 158bcf7f6e3SHans de Goede }; 159607ca46eSDavid Howells 160c01b244aSAlan Stern /* 161c01b244aSAlan Stern * USB_SPEED_* values returned by USBDEVFS_GET_SPEED are defined in 162c01b244aSAlan Stern * linux/usb/ch9.h 163c01b244aSAlan Stern */ 164c01b244aSAlan Stern 165607ca46eSDavid Howells #define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) 166607ca46eSDavid Howells #define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32) 167607ca46eSDavid Howells #define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer) 168607ca46eSDavid Howells #define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32) 169607ca46eSDavid Howells #define USBDEVFS_RESETEP _IOR('U', 3, unsigned int) 170607ca46eSDavid Howells #define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface) 171607ca46eSDavid Howells #define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int) 172607ca46eSDavid Howells #define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver) 173607ca46eSDavid Howells #define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb) 174607ca46eSDavid Howells #define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32) 175607ca46eSDavid Howells #define USBDEVFS_DISCARDURB _IO('U', 11) 176607ca46eSDavid Howells #define USBDEVFS_REAPURB _IOW('U', 12, void *) 177607ca46eSDavid Howells #define USBDEVFS_REAPURB32 _IOW('U', 12, __u32) 178607ca46eSDavid Howells #define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *) 179607ca46eSDavid Howells #define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32) 180607ca46eSDavid Howells #define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) 181607ca46eSDavid Howells #define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32) 182607ca46eSDavid Howells #define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) 183607ca46eSDavid Howells #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) 184607ca46eSDavid Howells #define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo) 185607ca46eSDavid Howells #define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl) 186607ca46eSDavid Howells #define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32) 187607ca46eSDavid Howells #define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo) 188607ca46eSDavid Howells #define USBDEVFS_RESET _IO('U', 20) 189607ca46eSDavid Howells #define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int) 190607ca46eSDavid Howells #define USBDEVFS_DISCONNECT _IO('U', 22) 191607ca46eSDavid Howells #define USBDEVFS_CONNECT _IO('U', 23) 192607ca46eSDavid Howells #define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int) 193607ca46eSDavid Howells #define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int) 194607ca46eSDavid Howells #define USBDEVFS_GET_CAPABILITIES _IOR('U', 26, __u32) 195607ca46eSDavid Howells #define USBDEVFS_DISCONNECT_CLAIM _IOR('U', 27, struct usbdevfs_disconnect_claim) 196bcf7f6e3SHans de Goede #define USBDEVFS_ALLOC_STREAMS _IOR('U', 28, struct usbdevfs_streams) 197bcf7f6e3SHans de Goede #define USBDEVFS_FREE_STREAMS _IOR('U', 29, struct usbdevfs_streams) 198d883f52eSReilly Grant #define USBDEVFS_DROP_PRIVILEGES _IOW('U', 30, __u32) 199c01b244aSAlan Stern #define USBDEVFS_GET_SPEED _IO('U', 31) 200607ca46eSDavid Howells 201607ca46eSDavid Howells #endif /* _UAPI_LINUX_USBDEVICE_FS_H */ 202