mirror of
https://github.com/erjiang/usbscale.git
synced 2025-07-19 02:24:25 -06:00
Updated comment documentation.
This commit is contained in:
parent
8c039b082c
commit
f68ac41120
24
usbscale.c
24
usbscale.c
@ -104,6 +104,10 @@ int main(void)
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
libusb_set_debug(NULL, 3);
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Next, we try to get a list of USB devices on this computer.
|
// Next, we try to get a list of USB devices on this computer.
|
||||||
cnt = libusb_get_device_list(NULL, &devs);
|
cnt = libusb_get_device_list(NULL, &devs);
|
||||||
@ -319,19 +323,25 @@ static int print_scale_data(char* dat) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// find_scale
|
||||||
|
// ----------
|
||||||
|
//
|
||||||
|
// **find_scale** takes a `libusb_device\*\*` list and loop through it,
|
||||||
|
// matching each device's vendor and product IDs to the scales.h list. It
|
||||||
|
// return the first matching `libusb_device\*` or 0 if no matching device is
|
||||||
|
// found.
|
||||||
|
//
|
||||||
static libusb_device* find_scale(libusb_device **devs)
|
static libusb_device* find_scale(libusb_device **devs)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
|
||||||
libusb_set_debug(NULL, 3);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
libusb_device* dev = 0;
|
libusb_device* dev = 0;
|
||||||
|
|
||||||
/*
|
//
|
||||||
* Loop through each usb device, and for each device, loop through the
|
// Loop through each USB device, and for each device, loop through the
|
||||||
* scales list to see if it's one of our listed scales
|
// scales list to see if it's one of our listed scales.
|
||||||
*/
|
//
|
||||||
while ((dev = devs[i++]) != NULL) {
|
while ((dev = devs[i++]) != NULL) {
|
||||||
struct libusb_device_descriptor desc;
|
struct libusb_device_descriptor desc;
|
||||||
int r = libusb_get_device_descriptor(dev, &desc);
|
int r = libusb_get_device_descriptor(dev, &desc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user