Commit 868bfe2b2ba2c6c7e6580ad35af85ad3fcb994bb
1 parent
9e61bde5
correct use of USBDEVFS_DISCONNECT
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1621 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
9 additions
and
4 deletions
usb-linux.c
| ... | ... | @@ -181,10 +181,15 @@ USBDevice *usb_host_device_open(const char *devname) |
| 181 | 181 | |
| 182 | 182 | #ifdef USBDEVFS_DISCONNECT |
| 183 | 183 | /* earlier Linux 2.4 do not support that */ |
| 184 | - ret = ioctl(fd, USBDEVFS_DISCONNECT); | |
| 185 | - if (ret < 0 && errno != ENODATA) { | |
| 186 | - perror("USBDEVFS_DISCONNECT"); | |
| 187 | - goto fail; | |
| 184 | + { | |
| 185 | + struct usbdevfs_ioctl ctrl; | |
| 186 | + ctrl.ioctl_code = USBDEVFS_DISCONNECT; | |
| 187 | + ctrl.ifno = 0; | |
| 188 | + ret = ioctl(fd, USBDEVFS_IOCTL, &ctrl); | |
| 189 | + if (ret < 0 && errno != ENODATA) { | |
| 190 | + perror("USBDEVFS_DISCONNECT"); | |
| 191 | + goto fail; | |
| 192 | + } | |
| 188 | 193 | } |
| 189 | 194 | #endif |
| 190 | 195 | ... | ... |