Skip to content

Commit

Permalink
drivers/richcomm_usb.c, drivers/nutdrv_atcl_usb.c, drivers/bcmxcp_usb…
Browse files Browse the repository at this point in the history
….c: sync naming changes with drivers/libusb1.c [networkupstools#1819, networkupstools#1763, networkupstools#1764]
  • Loading branch information
jimklimov committed Jan 22, 2023
1 parent bbb0777 commit a4e99da
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
7 changes: 4 additions & 3 deletions drivers/bcmxcp_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ static usb_dev_handle *open_powerware_usb(void)
ssize_t devcount = 0;
libusb_device_handle *udev;
struct libusb_device_descriptor dev_desc;
uint8_t bus;
uint8_t bus_num;
/* TODO: consider device_addr */
int i;

devcount = libusb_get_device_list(NULL, &devlist);
Expand All @@ -441,13 +442,13 @@ static usb_dev_handle *open_powerware_usb(void)

curDevice.VendorID = dev_desc.idVendor;
curDevice.ProductID = dev_desc.idProduct;
bus = libusb_get_bus_number(device);
bus_num = libusb_get_bus_number(device);
curDevice.Bus = (char *)malloc(4);
if (curDevice.Bus == NULL) {
libusb_free_device_list(devlist, 1);
fatal_with_errno(EXIT_FAILURE, "Out of memory");
}
sprintf(curDevice.Bus, "%03d", bus);
sprintf(curDevice.Bus, "%03d", bus_num);

/* FIXME: we should also retrieve
* dev->descriptor.iManufacturer
Expand Down
7 changes: 4 additions & 3 deletions drivers/nutdrv_atcl_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ static int usb_device_open(usb_dev_handle **handlep, USBDevice_t *device, USBDev
ssize_t devcount = 0;
libusb_device_handle *handle;
struct libusb_device_descriptor dev_desc;
uint8_t bus;
uint8_t bus_num;
/* TODO: consider device_addr */
int i;

devcount = libusb_get_device_list(NULL, &devlist);
Expand Down Expand Up @@ -341,13 +342,13 @@ static int usb_device_open(usb_dev_handle **handlep, USBDevice_t *device, USBDev
#if WITH_LIBUSB_1_0
device->VendorID = dev_desc.idVendor;
device->ProductID = dev_desc.idProduct;
bus = libusb_get_bus_number(dev);
bus_num = libusb_get_bus_number(dev);
device->Bus = (char *)malloc(4);
if (device->Bus == NULL) {
libusb_free_device_list(devlist, 1);
fatal_with_errno(EXIT_FAILURE, "Out of memory");
}
sprintf(device->Bus, "%03d", bus);
sprintf(device->Bus, "%03d", bus_num);
iManufacturer = dev_desc.iManufacturer;
iProduct = dev_desc.iProduct;
iSerialNumber = dev_desc.iSerialNumber;
Expand Down
7 changes: 4 additions & 3 deletions drivers/richcomm_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ static int usb_device_open(usb_dev_handle **handlep, USBDevice_t *device, USBDev
ssize_t devcount = 0;
libusb_device_handle *handle;
struct libusb_device_descriptor dev_desc;
uint8_t bus;
uint8_t bus_num;
/* TODO: consider device_addr */
int i;

devcount = libusb_get_device_list(NULL, &devlist);
Expand Down Expand Up @@ -391,13 +392,13 @@ static int usb_device_open(usb_dev_handle **handlep, USBDevice_t *device, USBDev
#if WITH_LIBUSB_1_0
device->VendorID = dev_desc.idVendor;
device->ProductID = dev_desc.idProduct;
bus = libusb_get_bus_number(dev);
bus_num = libusb_get_bus_number(dev);
device->Bus = (char *)malloc(4);
if (device->Bus == NULL) {
libusb_free_device_list(devlist, 1);
fatal_with_errno(EXIT_FAILURE, "Out of memory");
}
sprintf(device->Bus, "%03d", bus);
sprintf(device->Bus, "%03d", bus_num);
iManufacturer = dev_desc.iManufacturer;
iProduct = dev_desc.iProduct;
iSerialNumber = dev_desc.iSerialNumber;
Expand Down

0 comments on commit a4e99da

Please sign in to comment.