Revision 2cc59d8c
b/usb-linux.c | ||
---|---|---|
152 | 152 |
static int usb_host_close(USBHostDevice *dev); |
153 | 153 |
static int parse_filter(const char *spec, struct USBAutoFilter *f); |
154 | 154 |
static void usb_host_auto_check(void *unused); |
155 |
static int usb_host_read_file(char *line, size_t line_size, |
|
156 |
const char *device_file, const char *device_name); |
|
155 | 157 |
|
156 | 158 |
static int is_isoc(USBHostDevice *s, int ep) |
157 | 159 |
{ |
... | ... | |
781 | 783 |
struct usb_ctrltransfer ct; |
782 | 784 |
int ret; |
783 | 785 |
|
786 |
if (usb_fs_type == USB_FS_SYS) { |
|
787 |
char device_name[32], line[1024]; |
|
788 |
int configuration; |
|
789 |
|
|
790 |
sprintf(device_name, "%d-%d", s->bus_num, s->devpath); |
|
791 |
|
|
792 |
if (!usb_host_read_file(line, sizeof(line), "bConfigurationValue", |
|
793 |
device_name)) { |
|
794 |
goto usbdevfs; |
|
795 |
} |
|
796 |
if (sscanf(line, "%d", &configuration) != 1) { |
|
797 |
goto usbdevfs; |
|
798 |
} |
|
799 |
return configuration; |
|
800 |
} |
|
801 |
|
|
802 |
usbdevfs: |
|
784 | 803 |
ct.bRequestType = USB_DIR_IN; |
785 | 804 |
ct.bRequest = USB_REQ_GET_CONFIGURATION; |
786 | 805 |
ct.wValue = 0; |
Also available in: Unified diff