diff options
| author | 2018-01-07 02:41:48 +0100 | |
|---|---|---|
| committer | 2018-01-08 02:39:38 +0100 | |
| commit | 789b16a4a42ab56899092392f1c2d5dde6e9dd34 (patch) | |
| tree | 22f3cb17626f43f1545bb01a9cb238a389a82941 /src/usb.c | |
| parent | 7f601f8e5241756c09d08a1319d90f24b9f8b1bc (diff) | |
| download | usbmuxd-789b16a4a42ab56899092392f1c2d5dde6e9dd34.tar.gz usbmuxd-789b16a4a42ab56899092392f1c2d5dde6e9dd34.tar.bz2 | |
usb: Store the whole device descriptor in struct usb_device
Diffstat (limited to 'src/usb.c')
| -rw-r--r-- | src/usb.c | 7 |
1 files changed, 3 insertions, 4 deletions
| @@ -53,7 +53,6 @@ | |||
| 53 | struct usb_device { | 53 | struct usb_device { |
| 54 | libusb_device_handle *dev; | 54 | libusb_device_handle *dev; |
| 55 | uint8_t bus, address; | 55 | uint8_t bus, address; |
| 56 | uint16_t vid, pid; | ||
| 57 | char serial[256]; | 56 | char serial[256]; |
| 58 | int alive; | 57 | int alive; |
| 59 | uint8_t interface, ep_in, ep_out; | 58 | uint8_t interface, ep_in, ep_out; |
| @@ -61,6 +60,7 @@ struct usb_device { | |||
| 61 | struct collection tx_xfers; | 60 | struct collection tx_xfers; |
| 62 | int wMaxPacketSize; | 61 | int wMaxPacketSize; |
| 63 | uint64_t speed; | 62 | uint64_t speed; |
| 63 | struct libusb_device_descriptor devdesc; | ||
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | static struct collection device_list; | 66 | static struct collection device_list; |
| @@ -396,8 +396,7 @@ static int usb_device_add(libusb_device* dev) | |||
| 396 | usbdev->serial[res] = 0; | 396 | usbdev->serial[res] = 0; |
| 397 | usbdev->bus = bus; | 397 | usbdev->bus = bus; |
| 398 | usbdev->address = address; | 398 | usbdev->address = address; |
| 399 | usbdev->vid = devdesc.idVendor; | 399 | usbdev->devdesc = devdesc; |
| 400 | usbdev->pid = devdesc.idProduct; | ||
| 401 | usbdev->speed = 480000000; | 400 | usbdev->speed = 480000000; |
| 402 | usbdev->dev = handle; | 401 | usbdev->dev = handle; |
| 403 | usbdev->alive = 1; | 402 | usbdev->alive = 1; |
| @@ -542,7 +541,7 @@ uint16_t usb_get_pid(struct usb_device *dev) | |||
| 542 | if(!dev->dev) { | 541 | if(!dev->dev) { |
| 543 | return 0; | 542 | return 0; |
| 544 | } | 543 | } |
| 545 | return dev->pid; | 544 | return dev->devdesc.idProduct; |
| 546 | } | 545 | } |
| 547 | 546 | ||
| 548 | uint64_t usb_get_speed(struct usb_device *dev) | 547 | uint64_t usb_get_speed(struct usb_device *dev) |
