OLD | NEW |
1 /* | 1 /* |
2 * usbfs header structures | 2 * usbfs header structures |
3 * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org> | 3 * Copyright © 2007 Daniel Drake <dsd@gentoo.org> |
4 * Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com> | 4 * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com> |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2.1 of the License, or (at your option) any later version. | 9 * version 2.1 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Lesser General Public License for more details. | 14 * Lesser General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Lesser General Public | 16 * You should have received a copy of the GNU Lesser General Public |
17 * License along with this library; if not, write to the Free Software | 17 * License along with this library; if not, write to the Free Software |
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
19 */ | 19 */ |
20 | 20 |
21 #ifndef LIBUSB_USBFS_H | 21 #ifndef LIBUSB_USBFS_H |
22 #define LIBUSB_USBFS_H | 22 #define LIBUSB_USBFS_H |
23 | 23 |
| 24 #include <linux/types.h> |
| 25 |
24 #define SYSFS_DEVICE_PATH "/sys/bus/usb/devices" | 26 #define SYSFS_DEVICE_PATH "/sys/bus/usb/devices" |
25 | 27 |
26 struct usbfs_ctrltransfer { | 28 struct usbfs_ctrltransfer { |
27 /* keep in sync with usbdevice_fs.h:usbdevfs_ctrltransfer */ | 29 /* keep in sync with usbdevice_fs.h:usbdevfs_ctrltransfer */ |
28 uint8_t bmRequestType; | 30 uint8_t bmRequestType; |
29 uint8_t bRequest; | 31 uint8_t bRequest; |
30 uint16_t wValue; | 32 uint16_t wValue; |
31 uint16_t wIndex; | 33 uint16_t wIndex; |
32 uint16_t wLength; | 34 uint16_t wLength; |
33 | 35 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 int ioctl_code; /* MUST encode size + direction of data so the | 111 int ioctl_code; /* MUST encode size + direction of data so the |
110 * macros in <asm/ioctl.h> give correct values */ | 112 * macros in <asm/ioctl.h> give correct values */ |
111 void *data; /* param buffer (in, or out) */ | 113 void *data; /* param buffer (in, or out) */ |
112 }; | 114 }; |
113 | 115 |
114 struct usbfs_hub_portinfo { | 116 struct usbfs_hub_portinfo { |
115 unsigned char numports; | 117 unsigned char numports; |
116 unsigned char port[127]; /* port to device num mapping */ | 118 unsigned char port[127]; /* port to device num mapping */ |
117 }; | 119 }; |
118 | 120 |
| 121 #define USBFS_CAP_ZERO_PACKET 0x01 |
| 122 #define USBFS_CAP_BULK_CONTINUATION 0x02 |
| 123 #define USBFS_CAP_NO_PACKET_SIZE_LIM 0x04 |
| 124 #define USBFS_CAP_BULK_SCATTER_GATHER 0x08 |
| 125 |
| 126 #define USBFS_DISCONNECT_CLAIM_IF_DRIVER 0x01 |
| 127 #define USBFS_DISCONNECT_CLAIM_EXCEPT_DRIVER 0x02 |
| 128 |
| 129 struct usbfs_disconnect_claim { |
| 130 unsigned int interface; |
| 131 unsigned int flags; |
| 132 char driver[USBFS_MAXDRIVERNAME + 1]; |
| 133 }; |
| 134 |
119 #define IOCTL_USBFS_CONTROL _IOWR('U', 0, struct usbfs_ctrltransfer) | 135 #define IOCTL_USBFS_CONTROL _IOWR('U', 0, struct usbfs_ctrltransfer) |
120 #define IOCTL_USBFS_BULK _IOWR('U', 2, struct usbfs_bulktransfer) | 136 #define IOCTL_USBFS_BULK _IOWR('U', 2, struct usbfs_bulktransfer) |
121 #define IOCTL_USBFS_RESETEP _IOR('U', 3, unsigned int) | 137 #define IOCTL_USBFS_RESETEP _IOR('U', 3, unsigned int) |
122 #define IOCTL_USBFS_SETINTF _IOR('U', 4, struct usbfs_setinterface) | 138 #define IOCTL_USBFS_SETINTF _IOR('U', 4, struct usbfs_setinterface) |
123 #define IOCTL_USBFS_SETCONFIG _IOR('U', 5, unsigned int) | 139 #define IOCTL_USBFS_SETCONFIG _IOR('U', 5, unsigned int) |
124 #define IOCTL_USBFS_GETDRIVER _IOW('U', 8, struct usbfs_getdriver) | 140 #define IOCTL_USBFS_GETDRIVER _IOW('U', 8, struct usbfs_getdriver) |
125 #define IOCTL_USBFS_SUBMITURB _IOR('U', 10, struct usbfs_urb) | 141 #define IOCTL_USBFS_SUBMITURB _IOR('U', 10, struct usbfs_urb) |
126 #define IOCTL_USBFS_DISCARDURB _IO('U', 11) | 142 #define IOCTL_USBFS_DISCARDURB _IO('U', 11) |
127 #define IOCTL_USBFS_REAPURB _IOW('U', 12, void *) | 143 #define IOCTL_USBFS_REAPURB _IOW('U', 12, void *) |
128 #define IOCTL_USBFS_REAPURBNDELAY _IOW('U', 13, void *) | 144 #define IOCTL_USBFS_REAPURBNDELAY _IOW('U', 13, void *) |
129 #define IOCTL_USBFS_CLAIMINTF _IOR('U', 15, unsigned int) | 145 #define IOCTL_USBFS_CLAIMINTF _IOR('U', 15, unsigned int) |
130 #define IOCTL_USBFS_RELEASEINTF _IOR('U', 16, unsigned int) | 146 #define IOCTL_USBFS_RELEASEINTF _IOR('U', 16, unsigned int) |
131 #define IOCTL_USBFS_CONNECTINFO _IOW('U', 17, struct usbfs_connectinfo) | 147 #define IOCTL_USBFS_CONNECTINFO _IOW('U', 17, struct usbfs_connectinfo) |
132 #define IOCTL_USBFS_IOCTL _IOWR('U', 18, struct usbfs_ioctl) | 148 #define IOCTL_USBFS_IOCTL _IOWR('U', 18, struct usbfs_ioctl) |
133 #define IOCTL_USBFS_HUB_PORTINFO _IOR('U', 19, struct usbfs_hub_portinfo) | 149 #define IOCTL_USBFS_HUB_PORTINFO _IOR('U', 19, struct usbfs_hub_portinfo) |
134 #define IOCTL_USBFS_RESET _IO('U', 20) | 150 #define IOCTL_USBFS_RESET _IO('U', 20) |
135 #define IOCTL_USBFS_CLEAR_HALT _IOR('U', 21, unsigned int) | 151 #define IOCTL_USBFS_CLEAR_HALT _IOR('U', 21, unsigned int) |
136 #define IOCTL_USBFS_DISCONNECT _IO('U', 22) | 152 #define IOCTL_USBFS_DISCONNECT _IO('U', 22) |
137 #define IOCTL_USBFS_CONNECT _IO('U', 23) | 153 #define IOCTL_USBFS_CONNECT _IO('U', 23) |
| 154 #define IOCTL_USBFS_CLAIM_PORT _IOR('U', 24, unsigned int) |
| 155 #define IOCTL_USBFS_RELEASE_PORT _IOR('U', 25, unsigned int) |
| 156 #define IOCTL_USBFS_GET_CAPABILITIES _IOR('U', 26, __u32) |
| 157 #define IOCTL_USBFS_DISCONNECT_CLAIM _IOR('U', 27, struct usbfs_disconnect_cl
aim) |
| 158 |
| 159 extern usbi_mutex_static_t linux_hotplug_lock; |
| 160 |
| 161 #if defined(HAVE_LIBUDEV) |
| 162 int linux_udev_start_event_monitor(void); |
| 163 int linux_udev_stop_event_monitor(void); |
| 164 int linux_udev_scan_devices(struct libusb_context *ctx); |
| 165 void linux_udev_hotplug_poll(void); |
| 166 #else |
| 167 int linux_netlink_start_event_monitor(void); |
| 168 int linux_netlink_stop_event_monitor(void); |
| 169 void linux_netlink_hotplug_poll(void); |
| 170 #endif |
| 171 |
| 172 void linux_hotplug_enumerate(uint8_t busnum, uint8_t devaddr, const char *sys_na
me); |
| 173 void linux_hotplug_disconnected(uint8_t busnum, uint8_t devaddr, const char *sys
_name); |
| 174 |
| 175 int linux_get_device_address (struct libusb_context *ctx, int detached, |
| 176 uint8_t *busnum, uint8_t *devaddr, const char *dev_node, |
| 177 const char *sys_name); |
| 178 int linux_enumerate_device(struct libusb_context *ctx, |
| 179 uint8_t busnum, uint8_t devaddr, const char *sysfs_dir); |
138 | 180 |
139 #endif | 181 #endif |
OLD | NEW |