kopia lustrzana https://github.com/Hamlib/Hamlib
Fix usb_port.c to use new libusb format for pid:vid
rodzic
f3b8330331
commit
b358cdbd2e
|
@ -67,10 +67,11 @@ static libusb_device_handle *find_and_open_device(const hamlib_port_t *port)
|
||||||
char string[256];
|
char string[256];
|
||||||
int i, r;
|
int i, r;
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called LIBUSB_API_VERSION=%x\n", __func__, LIBUSB_API_VERSION);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called LIBUSB_API_VERSION=%x\n", __func__,
|
||||||
|
LIBUSB_API_VERSION);
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE,
|
rig_debug(RIG_DEBUG_VERBOSE,
|
||||||
"%s: looking for device %04x:%04x...",
|
"%s: looking for device %04x:%04x...\n",
|
||||||
__func__,
|
__func__,
|
||||||
port->parm.usb.vid,
|
port->parm.usb.vid,
|
||||||
port->parm.usb.pid);
|
port->parm.usb.pid);
|
||||||
|
@ -93,7 +94,7 @@ static libusb_device_handle *find_and_open_device(const hamlib_port_t *port)
|
||||||
libusb_get_device_descriptor(dev, &desc);
|
libusb_get_device_descriptor(dev, &desc);
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE,
|
rig_debug(RIG_DEBUG_VERBOSE,
|
||||||
" %04x:%04x,",
|
" %04x:%04x\n",
|
||||||
desc.idVendor,
|
desc.idVendor,
|
||||||
desc.idProduct);
|
desc.idProduct);
|
||||||
|
|
||||||
|
@ -243,6 +244,22 @@ int usb_port_open(hamlib_port_t *port)
|
||||||
pathname[HAMLIB_FILPATHLEN - 1] = '\0';
|
pathname[HAMLIB_FILPATHLEN - 1] = '\0';
|
||||||
|
|
||||||
p = pathname;
|
p = pathname;
|
||||||
|
|
||||||
|
if (strlen(pathname) == 9)
|
||||||
|
{
|
||||||
|
// then is new new libusb format with just vid:pid
|
||||||
|
int n = sscanf(pathname, "%x:%x", &port->parm.usb.vid, &port->parm.usb.pid);
|
||||||
|
|
||||||
|
if (n != 2)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: unable to parse vid:pid from '%s'\n", __func__,
|
||||||
|
pathname);
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
q = strchr(p, ':');
|
q = strchr(p, ':');
|
||||||
|
|
||||||
if (q)
|
if (q)
|
||||||
|
@ -274,6 +291,7 @@ int usb_port_open(hamlib_port_t *port)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
udh = find_and_open_device(port);
|
udh = find_and_open_device(port);
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue