mcuee
mcuee
BTW, I just took a very quick glance of the Sane usb code here. https://gitlab.com/sane-project/backends/-/blob/master/sanei/sanei_usb.c I am not so sure if the code here is a potential problem for macOS...
Just an update from libusb side, #852 has also been merged. From SANE side, they are looking at the concerns I raised. https://gitlab.com/sane-project/backends/-/issues/473
> I already tested with 1.0.25 rc1 macports libusb-devel. Same issue Comment out the following workaround to see it helps a bit or not under macOS. https://gitlab.com/sane-project/backends/-/blob/master/sanei/sanei_usb.c#L3131 ``` #elif defined(HAVE_LIBUSB)...
> The variable `workaround` is set if the environment variable `SANE_USB_WORKAROUND` is set to `1`. Has this been tried? @mcuee Did you mean commenting out the libusb_clear_halt() calls as well?...
> from the log it's seam an ep pipe operation to a non existing or opened pipe not a "stall" that would result from halt not cleared ? The workaround...
> The simplest way to do this would be to make version.h public (probably needs some sprucing up) as libusb_version.h, or something like that. Just wondering which project provides this...
Sample run log under macOS (Mac Mini M1). ``` mcuee@mcuees-Mac-mini stress_mt % ./stress-mt Thread 0 started Thread 3 started Thread 1 started Thread 4 started Thread 2 started Thread 5...
Note: as a general test code, then it needs to be cross-platform.
> oh if we can use C11 we can try [thrd_create](https://en.cppreference.com/w/c/thread/thrd_create) I believe it is not available in VS 2019/2022.
Maybe we can use similar workaround for Windows like this libusb dfp example. https://github.com/libusb/libusb/blob/master/examples/dpfp.c Or probably just use Windows specific codes for Windows. https://docs.microsoft.com/en-us/cpp/parallel/multithreading-with-c-and-win32?view=msvc-160