core: Kill backend get_device_descriptor() function
authorChris Dickens <christopher.a.dickens@gmail.com>
Tue, 28 Apr 2020 19:08:08 +0000 (12:08 -0700)
committerChris Dickens <christopher.a.dickens@gmail.com>
Tue, 28 Apr 2020 19:08:08 +0000 (12:08 -0700)
commitd21956dc3357bb40cde6d47eaf2497caf8d0a2de
tree246da844ea27ccf20b25f2e91d3e7e24e88e398e
parenta157b55656e7130c4ea118abcb1dfad21db428b8
core: Kill backend get_device_descriptor() function

Simplify the library by moving device descriptor initialization to the
backend, while the device is being set up. This removes the duplication
of essentially the same code in every backend.

Add some missing calls to libusb_le16_to_cpu() when reading multi-byte
fields from the "raw" device descriptor. It has worked thus far because
the platforms not using the calls happen to be the same endianness as
the USB bus.

While here, throw in some static assertions to ensure there is no
mismatch between the libusb device descriptor structure and any
device descriptor structure provided by the platform headers.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
18 files changed:
libusb/core.c
libusb/descriptor.c
libusb/libusbi.h
libusb/os/darwin_usb.c
libusb/os/haiku_pollfs.cpp
libusb/os/haiku_usb_raw.cpp
libusb/os/linux_usbfs.c
libusb/os/netbsd_usb.c
libusb/os/null_usb.c
libusb/os/openbsd_usb.c
libusb/os/sunos_usb.c
libusb/os/sunos_usb.h
libusb/os/windows_common.c
libusb/os/windows_common.h
libusb/os/windows_usbdk.c
libusb/os/windows_winusb.c
libusb/os/windows_winusb.h
libusb/version_nano.h