Add support for USB device without usb_set_configuration() and

without usb_claim_interface(). Looks like needed on Windows 7.


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2994 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.13
Stéphane Fillod, F8CFE 2010-10-08 20:43:53 +00:00
rodzic 7f06be1267
commit db563f7aaf
2 zmienionych plików z 27 dodań i 21 usunięć

Wyświetl plik

@ -226,8 +226,10 @@ int si570avrusb_init(RIG *rig)
rp->parm.usb.vid = USBDEV_SHARED_VID;
rp->parm.usb.pid = USBDEV_SHARED_PID;
/* no usb_set_configuration() and usb_claim_interface() */
rp->parm.usb.iface = -1;
rp->parm.usb.conf = 1;
rp->parm.usb.iface = 0;
rp->parm.usb.alt = 0; /* necessary ? */
rp->parm.usb.vendor_name = VENDOR_NAME;

Wyświetl plik

@ -189,34 +189,38 @@ int usb_port_open(hamlib_port_t *port)
usb_detach_kernel_driver_np(udh, port->parm.usb.iface);
#endif
if (port->parm.usb.iface >= 0) {
#ifdef _WIN32
if (usb_set_configuration (udh, port->parm.usb.conf) < 0){
rig_debug(RIG_DEBUG_ERR, "%s: usb_set_configuration: failed conf %d: %s\n",
__func__,port->parm.usb.conf, usb_strerror());
usb_close (udh);
return -RIG_EIO;
}
if (usb_set_configuration (udh, port->parm.usb.conf) < 0){
rig_debug(RIG_DEBUG_ERR, "%s: usb_set_configuration: failed conf %d: %s\n",
__func__,port->parm.usb.conf, usb_strerror());
usb_close (udh);
return -RIG_EIO;
}
#endif
rig_debug(RIG_DEBUG_VERBOSE, "%s: claiming %d\n", __func__, port->parm.usb.iface);
rig_debug(RIG_DEBUG_VERBOSE, "%s: claiming %d\n", __func__, port->parm.usb.iface);
if (usb_claim_interface (udh, port->parm.usb.iface) < 0){
rig_debug(RIG_DEBUG_ERR, "%s:usb_claim_interface: failed interface %d: %s\n",
__func__,port->parm.usb.iface, usb_strerror());
usb_close (udh);
return -RIG_EIO;
}
if (usb_claim_interface (udh, port->parm.usb.iface) < 0){
rig_debug(RIG_DEBUG_ERR, "%s:usb_claim_interface: failed interface %d: %s\n",
__func__,port->parm.usb.iface, usb_strerror());
usb_close (udh);
return -RIG_EIO;
}
#if 0
if (usb_set_altinterface (udh, port->parm.usb.alt) < 0){
fprintf (stderr, "%s:usb_set_alt_interface: failed: %s\n", __func__,
usb_strerror());
usb_release_interface (udh, port->parm.usb.iface);
usb_close (udh);
return -RIG_EIO;
}
if (usb_set_altinterface (udh, port->parm.usb.alt) < 0){
fprintf (stderr, "%s:usb_set_alt_interface: failed: %s\n", __func__,
usb_strerror());
usb_release_interface (udh, port->parm.usb.iface);
usb_close (udh);
return -RIG_EIO;
}
#endif
}
port->handle = (void*) udh;
return RIG_OK;