mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-29 23:42:14 +00:00
(libusb) Add manufacturer descriptor/device descriptor to interface struct
This commit is contained in:
parent
e1d67f23b1
commit
f8b405a4d2
@ -1,4 +1,5 @@
|
||||
HAVE_LIBRETRODB = 1
|
||||
#HAVE_LIBUSB = 1
|
||||
|
||||
ifeq ($(HAVE_LIBRETRODB), 1)
|
||||
DEFINES += -DHAVE_LIBRETRODB
|
||||
@ -393,6 +394,7 @@ ifeq ($(HAVE_UDEV), 1)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LIBUSB), 1)
|
||||
DEFINES += -DHAVE_LIBUSB
|
||||
OBJ += input/drivers_hid/libusb_hid.o
|
||||
LIBS += -lusb-1.0
|
||||
JOYCONFIG_LIBS += -lusb-1.0
|
||||
|
@ -29,6 +29,9 @@ struct libusb_adapter
|
||||
struct libusb_device *device;
|
||||
libusb_device_handle *handle;
|
||||
|
||||
uint8_t manufacturer_name[255];
|
||||
uint8_t name[255];
|
||||
|
||||
sthread_t *thread;
|
||||
struct libusb_adapter *next;
|
||||
};
|
||||
@ -60,7 +63,6 @@ static int add_adapter(struct libusb_device *dev)
|
||||
fprintf(stderr, "Allocation of adapter failed.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = libusb_get_device_descriptor(dev, &desc);
|
||||
|
||||
if (rc != LIBUSB_SUCCESS)
|
||||
@ -80,6 +82,23 @@ static int add_adapter(struct libusb_device *dev)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (desc.iManufacturer)
|
||||
{
|
||||
libusb_get_string_descriptor_ascii(adapter->handle,
|
||||
desc.iManufacturer, adapter->manufacturer_name,
|
||||
sizeof(adapter->manufacturer_name));
|
||||
fprintf(stderr, "Adapter Manufacturer name: %s\n",
|
||||
adapter->manufacturer_name);
|
||||
}
|
||||
|
||||
if (desc.iProduct)
|
||||
{
|
||||
libusb_get_string_descriptor_ascii(adapter->handle,
|
||||
desc.iProduct, adapter->name,
|
||||
sizeof(adapter->name));
|
||||
fprintf(stderr, "Adapter name: %s\n", adapter->name);
|
||||
}
|
||||
|
||||
if (libusb_kernel_driver_active(adapter->handle, 0) == 1
|
||||
&& libusb_detach_kernel_driver(adapter->handle, 0))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user