From: jan v. k. <j.v...@gm...> - 2012-07-28 17:44:43
|
Installing libusbx-1.012 seems to solve the problem. Thanx for the excellent work in developing interfaces for true portability. all the best jan 2012/7/28 Xiaofan Chen <xia...@gm...> > Please reply to the list. Thanks. > > On Sat, Jul 28, 2012 at 6:53 PM, jan van katwijk <j.v...@gm...> > wrote: > > Thanx > > > > The problem is that there is no error message, often just hanging of the > > whole system. > > > > The libusb-1.-9 version I am using has as its last entry in the changelog > > april 20. > > > > The main issue was whether behaviour under windows wrt simultaneously > > receiving data using bulk transfer > > (asynchronous API) while sending control bits, should be expected the > same > > as under Linux. > > If so, I should instrument the code and see where I made an error, if > > behaviour can be different I should > > find a different programmatic solution. > > > > In detail: I have a Qthread for handling the asynchronous libusb > interface > > (i.e. catching the events), this thread > > continues to deliver data on the required speed. It seems pretty standard > > code, based on some examples > > I found on the net and on the code in the osmocom library for the rtl, > but > > then adapted for use with Qt > > > > void RTL2832U::run (void) { > > int32_t i; > > struct timeval tv = {1, 0}; > > > > rtl_is_running = true; > > while (rtl_should_run) { > > while (TheDevice -> async_status == RTLSDR_INACTIVE) > > msleep (1); > > > > // fprintf (stderr, "off we go\n"); > > if (!resetBuffer ()) > > fprintf (stderr, "failed to reset\n"); > > // > > // could have been done on init > > for (i = 0; i < (int)(TheDevice -> xfer_buf_num); i ++) { > > libusb_fill_bulk_transfer (TheDevice -> xfer [i], > > TheDevice -> devh, > > 0x81, > > TheDevice -> xfer_buf [i], > > TheDevice -> xfer_buf_len, > > _libusb_callback, > > (void *)TheDevice, > > BULK_TIMEOUT); > > libusb_submit_transfer (TheDevice -> xfer [i]); > > } > > while (TheDevice -> async_status != RTLSDR_INACTIVE) { > > libusb_handle_events_timeout (TheDevice -> ctx, &tv); > > > > if (TheDevice -> async_status == RTLSDR_CANCELING) { > > TheDevice -> async_status = RTLSDR_INACTIVE; > > > > if (TheDevice ->xfer == NULL) > > break; > > > > for (i = 0; i < (int)(TheDevice -> xfer_buf_num); i ++) > { > > if (TheDevice -> xfer [i] == NULL) > > continue; > > > > if (TheDevice -> xfer [i] -> status == > > LIBUSB_TRANSFER_COMPLETED) { > > libusb_cancel_transfer (TheDevice -> xfer [i]); > > TheDevice -> async_status = RTLSDR_CANCELING; > > } > > } > > > > } > > } > > } > > > > > > Another thread (the main thread in the Qt application) calls on the > libusb > > interface for setting and reading control data > > all using constructs like > > r = libusb_control_transfer (TheDevice -> devh, CTRL_IN, 0, > addr, > > index, array, > > len, CTRL_TIMEOUT); > > > > I do have another radio through the usb gate connected, and control works > > fine. The problem starts > > as said above when sending control messages while the bulk transfers are > on, > > but again, only > > windows. No problem whatsoever in Linux (Fedora 17 64 bits, fedora 16 64 > > bits, ubuntu 12.04 64 bits). > > > > If behaviour SHOULD be exactly the same under windows and linux, then > > apparently I am making some programming > > error, which can be as simple as an unitialized variable. Then I need to > set > > up a debugging environment for > > use with Mingw64 and reinspect all elements of my code. > > > > anyway, thanx so far > > You may want to use libusb.git since libusb-1.0.9 has serious bugs > under Windows. Or you can use libusbx-1.0.12. > http://git.libusb.org/?p=libusb.git > http://libusbx.org/ > > -- > Xiaofan > -- Jan van Katwijk +31 (0)15 3698980 +31 (0) 628260355 |