From a0442ed58dee48a521ea053083ea967894507898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 11 Jul 2018 22:19:56 +0200 Subject: New upstream version 2.0.1+repack --- spectro/colorhug.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'spectro/colorhug.c') 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)); -- cgit v1.2.3