kopia lustrzana https://github.com/Hamlib/Hamlib
Allow USB device's VID/PID/Vendor/Product to be explicitly specified
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@3041 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.13
rodzic
0de9cc17d2
commit
91deafbcb3
|
@ -168,6 +168,7 @@ static struct usb_dev_handle *find_and_open_device(const hamlib_port_t *port)
|
||||||
int usb_port_open(hamlib_port_t *port)
|
int usb_port_open(hamlib_port_t *port)
|
||||||
{
|
{
|
||||||
struct usb_dev_handle *udh;
|
struct usb_dev_handle *udh;
|
||||||
|
char *p, *q;
|
||||||
|
|
||||||
usb_init (); /* usb library init */
|
usb_init (); /* usb library init */
|
||||||
if (usb_find_busses () < 0)
|
if (usb_find_busses () < 0)
|
||||||
|
@ -177,6 +178,31 @@ int usb_port_open(hamlib_port_t *port)
|
||||||
rig_debug(RIG_DEBUG_ERR, "%s: usb_find_devices failed %s\n",
|
rig_debug(RIG_DEBUG_ERR, "%s: usb_find_devices failed %s\n",
|
||||||
__func__, usb_strerror());
|
__func__, usb_strerror());
|
||||||
|
|
||||||
|
p = port->pathname;
|
||||||
|
q = strchr(p, ':');
|
||||||
|
if (q) {
|
||||||
|
if (q != p+1)
|
||||||
|
port->parm.usb.vid = strtol(q, NULL, 16);
|
||||||
|
p = q+1;
|
||||||
|
q = strchr(p, ':');
|
||||||
|
if (q) {
|
||||||
|
if (q != p+1)
|
||||||
|
port->parm.usb.pid = strtol(q, NULL, 16);
|
||||||
|
p = q+1;
|
||||||
|
q = strchr(p, ':');
|
||||||
|
if (q) {
|
||||||
|
if (q != p+1)
|
||||||
|
port->parm.usb.vendor_name = q;
|
||||||
|
p = q+1;
|
||||||
|
q = strchr(p, ':');
|
||||||
|
if (q) {
|
||||||
|
if (q != p+1)
|
||||||
|
port->parm.usb.product = q;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
udh = find_and_open_device(port);
|
udh = find_and_open_device(port);
|
||||||
if (udh == 0)
|
if (udh == 0)
|
||||||
return -RIG_EIO;
|
return -RIG_EIO;
|
||||||
|
|
Ładowanie…
Reference in New Issue