summaryrefslogtreecommitdiff
path: root/spectro/colorhug.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2018-07-23 07:19:57 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-07-23 07:19:57 +0200
commit006b114e9ff78391ed4c19c1ece639b72e804e08 (patch)
treeae41e36564e8c0c38fd374c973fde256b0186551 /spectro/colorhug.c
parentba627dd9ecb578e9852c7b9cce67ec63199d1acf (diff)
parent44e0e31ae94236e3e81567dfd6b919b053d0bbe0 (diff)
Merge branch 'release/debian/2.0.1-1'HEADdebian/2.0.1+repack-1master
Diffstat (limited to 'spectro/colorhug.c')
-rwxr-xr-xspectro/colorhug.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/spectro/colorhug.c b/spectro/colorhug.c
index aa8ba21..e09362c 100755
--- a/spectro/colorhug.c
+++ b/spectro/colorhug.c
@@ -435,6 +435,7 @@ static inst_code
colorhug_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) {
int se;
colorhug *p = (colorhug *) pp;
+ icomuflags usbflags = icomuf_none;
a1logd(p->log, 2, "colorhug_init_coms: About to init coms\n");
@@ -444,7 +445,7 @@ colorhug_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) {
a1logd(p->log, 3, "colorhug_init_coms: About to init HID\n");
/* Set config, interface */
- if ((se = p->icom->set_hid_port(p->icom, icomuf_none, 0, NULL)) != ICOM_OK) {
+ if ((se = p->icom->set_hid_port(p->icom, usbflags, 0, NULL)) != ICOM_OK) {
a1logd(p->log, 1, "colorhug_init_coms: set_hid_port failed ICOM err 0x%x\n",se);
return colorhug_interp_code((inst *)p, icoms2colorhug_err(se));
}
@@ -453,9 +454,16 @@ colorhug_init_coms(inst *pp, baud_rate br, flow_control fc, double tout) {
a1logd(p->log, 3, "colorhug_init_coms: About to init USB\n");
+#if defined(UNIX_X11)
+ usbflags |= icomuf_detach;
+ /* Some Linux drivers can't open the device a second time, so */
+ /* use the reset on close workaround. */
+ usbflags |= icomuf_reset_before_close;
+#endif
+
/* Set config, interface, write end point, read end point */
// ~~ does Linux need icomuf_reset_before_close ? Why ?
- if ((se = p->icom->set_usb_port(p->icom, 1, 0x00, 0x00, icomuf_detach, 0, NULL))
+ if ((se = p->icom->set_usb_port(p->icom, 1, 0x00, 0x00, usbflags, 0, NULL))
!= ICOM_OK) {
a1logd(p->log, 1, "colorhug_init_coms: set_usb_port failed ICOM err 0x%x\n",se);
return colorhug_interp_code((inst *)p, icoms2colorhug_err(se));