usbdevice_fs.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*****************************************************************************/
  2. /*
  3. * usbdevice_fs.h -- USB device file system.
  4. *
  5. * Copyright (C) 2000
  6. * Thomas Sailer (sailer@ife.ee.ethz.ch)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. *
  22. * History:
  23. * 0.1 04.01.2000 Created
  24. *
  25. * $Id: usbdevice_fs.h,v 1.1.1.1 2007/06/12 07:27:16 eyryu Exp $
  26. */
  27. /*****************************************************************************/
  28. #ifndef _LINUX_USBDEVICE_FS_H
  29. #define _LINUX_USBDEVICE_FS_H
  30. #include <linux/types.h>
  31. #include <linux/magic.h>
  32. /* --------------------------------------------------------------------- */
  33. /* usbdevfs ioctl codes */
  34. struct usbdevfs_ctrltransfer {
  35. __u8 bRequestType;
  36. __u8 bRequest;
  37. __u16 wValue;
  38. __u16 wIndex;
  39. __u16 wLength;
  40. __u32 timeout; /* in milliseconds */
  41. void __user *data;
  42. };
  43. struct usbdevfs_bulktransfer {
  44. unsigned int ep;
  45. unsigned int len;
  46. unsigned int timeout; /* in milliseconds */
  47. void __user *data;
  48. };
  49. struct usbdevfs_setinterface {
  50. unsigned int interface;
  51. unsigned int altsetting;
  52. };
  53. struct usbdevfs_disconnectsignal {
  54. unsigned int signr;
  55. void __user *context;
  56. };
  57. #define USBDEVFS_MAXDRIVERNAME 255
  58. struct usbdevfs_getdriver {
  59. unsigned int interface;
  60. char driver[USBDEVFS_MAXDRIVERNAME + 1];
  61. };
  62. struct usbdevfs_connectinfo {
  63. unsigned int devnum;
  64. unsigned char slow;
  65. };
  66. #define USBDEVFS_URB_SHORT_NOT_OK 1
  67. #define USBDEVFS_URB_ISO_ASAP 2
  68. #define USBDEVFS_URB_TYPE_ISO 0
  69. #define USBDEVFS_URB_TYPE_INTERRUPT 1
  70. #define USBDEVFS_URB_TYPE_CONTROL 2
  71. #define USBDEVFS_URB_TYPE_BULK 3
  72. struct usbdevfs_iso_packet_desc {
  73. unsigned int length;
  74. unsigned int actual_length;
  75. unsigned int status;
  76. };
  77. struct usbdevfs_urb {
  78. unsigned char type;
  79. unsigned char endpoint;
  80. int status;
  81. unsigned int flags;
  82. void __user *buffer;
  83. int buffer_length;
  84. int actual_length;
  85. int start_frame;
  86. int number_of_packets;
  87. int error_count;
  88. unsigned int signr; /* signal to be sent on error, -1 if none should be sent */
  89. void *usercontext;
  90. struct usbdevfs_iso_packet_desc iso_frame_desc[0];
  91. };
  92. /* ioctls for talking directly to drivers */
  93. struct usbdevfs_ioctl {
  94. int ifno; /* interface 0..N ; negative numbers reserved */
  95. int ioctl_code; /* MUST encode size + direction of data so the
  96. * macros in <asm/ioctl.h> give correct values */
  97. void __user *data; /* param buffer (in, or out) */
  98. };
  99. /* You can do most things with hubs just through control messages,
  100. * except find out what device connects to what port. */
  101. struct usbdevfs_hub_portinfo {
  102. char nports; /* number of downstream ports in this hub */
  103. char port [127]; /* e.g. port 3 connects to device 27 */
  104. };
  105. #ifdef __KERNEL__
  106. #ifdef CONFIG_COMPAT
  107. #include <linux/compat.h>
  108. struct usbdevfs_urb32 {
  109. unsigned char type;
  110. unsigned char endpoint;
  111. compat_int_t status;
  112. compat_uint_t flags;
  113. compat_caddr_t buffer;
  114. compat_int_t buffer_length;
  115. compat_int_t actual_length;
  116. compat_int_t start_frame;
  117. compat_int_t number_of_packets;
  118. compat_int_t error_count;
  119. compat_uint_t signr;
  120. compat_caddr_t usercontext; /* unused */
  121. struct usbdevfs_iso_packet_desc iso_frame_desc[0];
  122. };
  123. struct usbdevfs_ioctl32 {
  124. s32 ifno;
  125. s32 ioctl_code;
  126. compat_caddr_t data;
  127. };
  128. #endif
  129. #endif /* __KERNEL__ */
  130. #define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer)
  131. #define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer)
  132. #define USBDEVFS_RESETEP _IOR('U', 3, unsigned int)
  133. #define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface)
  134. #define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int)
  135. #define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver)
  136. #define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb)
  137. #define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32)
  138. #define USBDEVFS_DISCARDURB _IO('U', 11)
  139. #define USBDEVFS_REAPURB _IOW('U', 12, void *)
  140. #define USBDEVFS_REAPURB32 _IOW('U', 12, __u32)
  141. #define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *)
  142. #define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32)
  143. #define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal)
  144. #define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int)
  145. #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
  146. #define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo)
  147. #define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl)
  148. #define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32)
  149. #define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo)
  150. #define USBDEVFS_RESET _IO('U', 20)
  151. #define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)
  152. #define USBDEVFS_DISCONNECT _IO('U', 22)
  153. #define USBDEVFS_CONNECT _IO('U', 23)
  154. #endif /* _LINUX_USBDEVICE_FS_H */