-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libuvc on Windows #12
Comments
There are probably two issues:
If you're wondering the difference, WinUSB is the official microsoft "generic" USB driver, libusbK is an open source implementation of WinUSB, and I'm not sure about libusb-win32. This page has some comparisons. Anyway, the second problem is that libusb doesn't support isochronous transfers on Windows (which I assume UVC uses). Although the libusbk backend does support isochronous transfers, the libusb library ignores that and treats all WinUSB-compatible backends equally. However I asked about this on the mailing list and there are two possible solutions. Solution one is to use a modified version of libusb that directly supports libusbk and therefore allows isochronous endpoints. Solution two is to use yet another USB driver - UsbDk which supports isochronous transfers (and is also easier to install than the others). There is another modified version of libusb that supports this backend. For my own project I am going to try solution two as I think it will lead to a nicer user experience. By the way I did notice some things about "filter drivers" which may mean you don't need to uninstall Windows' native UVC drivers but that is a total guess. There is yet another generic USB driver |
By the way, I'm going to have a go at this. Would you mind posting your modifications? |
@Timmmm This is very relevant for us as well. Will you develop in a fork? We would like to contribute and test. @MichaelBarz What do you think? |
@Timmmm Thanks for all the info. Unfortunately, I moved my development over to native cross-platform drivers for the project I was working on, and for the life of me, I can't find my libuvc mods... Sorry. However, I know Steven Lovegrove (https://github.com/stevenlovegrove/libuvc) started a Windows version too. |
Ok I will have a look at his fork. I wish github let you give forks descriptions. Sometimes it's really hard to work out what the difference between them all is! @mkassner if I get it to work I'll post here. Not sure about code as it is for work and they're a bit paranoid about IP. Hopefully it won't require many code changes anyway. |
I describe what I've done until here and also I need some further information.
Questions: Does CMake an automatic choise of the 64bit compiler refering to the MinGW64/dll path?
All seems to work. I will run some tests in next few days. last stupid question: mingw32-make is reffering to 32bit or 64bit or it has nothing to do with this because all is already setup in CMAKE when i generate? |
@flecheria WinUSB won't work because it doesn't support isochronous endpoints (required for UVC) until Windows 8 (and libusb doesn't take advantage of that support anyway). libusbK does support isochronous endpoints but again libusb doesn't take advantage of that support. However there are old patches for libusb that change it to add support for libusbK's isochronous API. This is "solution one" that I linked before. So you (or I) need to port those old libusb patches to the current version (shouldn't be too hard), then compile that version of libusb, install the libusbK driver using Zadig, and then hopefully it should work. The downside of this method is that no other apps will be able to use the webcam because you'll have to uninstall the system UVC driver. The other option - UsbDk which I linked before as "solution two", might work too and might not require removing the system UVC driver. However I just had a bad experience with it so I am going to avoid it for now! |
@Timmmm I rebuild libusb with the patches as you suggest on solution 1, uninstall WinUSB and install libusbK. It seems works. |
There is an isochronous benchmark example here: https://github.com/libusb/libusb/blob/master/examples/sam3u_benchmark.c One of my uses for isochronous transfers with libusb is for an application Probably the easiest way to get something that sends isochronous transfers Then you can modify one of the mBed USB examples to just write isochronous Or you could wait a week or two until I have time to give it a go. Or just Cheers, Tim On 14 June 2015 at 16:25, paolo cappelletto notifications@github.com
|
Oh Thanks |
I had a go at this. It got fairly far - submitting the iso transfers On 16 June 2015 at 16:12, paolo cappelletto notifications@github.com
|
I asked on the mailing list but no reply... I may brave UsbDk again... |
Ok, I downloaded libusbK and tried using it directly rather than through libusb and it worked! Therefore it seems to me like the libusb patches to add support for libusbK isochronous transfers are incorrect in some way. I haven't investigated what they do differently to the libusbK example code. |
@Timmmm, sounds great! I recently tried to build libuvc on Windows too, but without success. Could you share your steps on how you replaced libusb by libusbK? And what is you system setup? Best, Michael |
Same here. I managed to compile libuvc and libusb. I can enumerate devices, connect, and when I try to start streaming I get UVC_ERROR_NOT_SUPPORTED, that came from inside libusb (LIBUSB_ERROR_NOT_SUPPORTED). Tried with WinUSB and libusbK drivers using Zadig. I'm checking libusbK, does any of you guys managed to port libuvc to use libusbK? |
Yeah maurosanjo - that is the expected response (see my previous comments). I've tested the libusbK api directly (not with libuvc) and it worked, and I've tested libuvc using libusb with a libusbK backend that supports isochronous transfers but it didn't work. Probably easier and better to fix the libusbK backend for libusb than to port libuvc to libusbK. Alternatively if you don't care about windows 7 you could upgrade to windows 10 and add in the isochronous support in libusb for the WinUSB backend. |
Hi. I tried to get this running again. I used libusbK (Zadig), Windows Release of libusb-1.0. There are a few things that I could solve or circumvent:
I use the release version of libusb, which might cause this problem, because it does not support iso transfer. I'll try with another version and report if I had success. There are forks that claim to support iso transfers with libusbK. |
Just tried Windows build of 0.0.5 of libuvc based on Windows 1.0.20 libusb binaries release from official site here: http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.20/libusb-1.0.20.7z/download [Edit: on Windows 7 - is this the problem?] Everything still exactly as reported by @MichaelBarz above. I used Zadig and tried the WinUSB and libusbK driver. I also had to disable the debugging macros (but then able to get debug build). Everything with querying the camera works - but streaming breaks on This is a real shame and a bit of showstopper... Looking through commit log it doesn't seem like there has been any updates on the master branch that might address this. Might it actually be a problem with the release build of libusb then? My next step was going to go down the rabbit hole of creating a windows debug build of libusb to find where |
Digging into the libusb code for 1.0.20 says it all really... /libusb/os/windows_usb.c
|
@timlukins I dont think this call makes sense on windows. It should be omitted since windows does not know the concept of a 'kernel driver' AFAIK . I dont have the knowledge or time to get this to work on windows and my suspicion is that the real problem comes down to getting this to work: libusb/libusb#46 We really want to see libuvc working on windows and plan to put a (substantial) bounty on this. Interested? |
I could get libuvc to work on Windows 10 or later (well actually Windows 8). Did you mean you plan to put a substantial bounty on it? If so I'm interested (assuming you don't require Windows 7 support). |
@Timmmm if that is the case we should talk! Please contact me: moritz [at] pupil-labs dot com |
Has anyone been able to solve this? |
Are there any updates on this? |
We made this fork work for windows: https://github.com/pupil-labs/libuvc You will need to use libusbK drivers. |
Hello @mkassner, |
I was able to make it working on windows a couple of years ago using this fork https://github.com/ftaiolivista/libuvc |
OK, I'll give it a try! |
Found some notes that can help you. Use LibUSB fork from pupil labs, follow this instructions: https://github.com/pupil-labs/libusb/blob/master/INSTALL_WIN.txt Use my LibUVC fork ( https://github.com/ftaiolivista/libuvc ) following this instructions: https://github.com/ftaiolivista/libuvc/blob/master/INSTALL_WINDOWS.md You may need turbo jpeg: |
I asked pupil-labs about upstreaming their changes here (pupil-labs#34) and got no response, so I may try to just merge those manually, unless someone else would like to submit a PR. |
Fix multiple stream stop issues
Anyone use the usbdk driver on Windows? I use this fork: https://github.com/pupil-labs/libuvc
step3: run my code I got the log:
any idea? thanks! |
Excuse me, I see you are talking about uvc and libusb. I need to use libusb in Windows to send data to the uvc camera (at the same time I need to use opencv to play the camera screen), I am now facing a problem:
|
Hi. In an old project I managed to use libusbk + libuvc + opencv on windows in a C++. I'm able to liveview webcam and send USB commands to the same device. |
Hi, thank you for your prompt, I have seen the relevant information of libuvc, but have not decided to use this method. I think I should try this method |
Oh,In addition, there is a situation where I can use a simple uvcplayer to play the screen and use the data sending function of Bus Hound at the same time. They work well together. |
Hi, I encountered the same problem as you, did you find way to send command to uvc camera without changing uvc driver? |
no, sorry |
I haven't found a way to send commands directly, but you can use the method defined in DirectShow, Dshow.h to control the camera(it's send the relevant command automatically,but you can't define your own), and it won't affect your ability to use other processes to play pictures |
i know its late,had the same issue UVC_ERROR_NOT_SUPPORTED, the fix was using zadig to replace both the composite and normal driver with (WinUsb driver) for the camera, under zadig list all devices -> ensure the option "Ignore hubs or composite parents" is unticked, a warning message would come, choose yes and replace the composite driver, Mine worked on libuvc(master), libusb(master) and windows10 64-bit release build, Hopefully helps someone else |
Yes, this may be related to the known issue of libusb libusb/libusb#85 if your device use IAD. Or you can try this libusb pull request if your device use IAD. |
vcpkg libuvc formula is supposed to work but somehow it does not work for me. Edit: they have updated to say libuvc is for Linux only. |
https://github.com/pupil-labs/libuvc is still easier to use for Windows users. You do not need to use the libusb fork there, rather you can use the official libusb. |
Latest build of https://github.com/pupil-labs/libuvc git head with libusb-1.0.26 (dynamic link) and pthreads-w32-2-9-1-release, using VS2019 (both 32bit and 64bit). |
I succeed to work a UVC webcam on Windows. I used libusb v1.0.26 and libuvc v0.0.6 |
If you think there is a bug in libusb, please create a PR against libusb git HEAD here. You should fork libusb project and then modify from there. Nobody will be able to understand what you are doing in your repo. You need to write more proper commit message to provide details of your changes. And your paticular commit may not be applicable to libusb git HEAD any more as there are quite some changes compared to 1.0.26 release. But one thing you are right is that isoc transfer support under Windows is not so good, especially with WInUSB. You may have better results with libusbk. |
Instructions to build libuvc under Winodws and MSYS2 by @FrostKiwi. I have not tried it myself. |
The above instruction seems to work with latest libuvc git HEAD. click for the detailed run log
|
For those who are interested, you can try the binary here, using latest git commit 37734b0 It seems to work.
|
I am not so sure how to get a proper patch to libuvc to build under MSYS2/mingw nicely as I do not know much about CMake. Hopefully @FrostKiwi or others can create a PR to sort out this long standing issue. |
|
Has anyone successfully streamed webcam images from this library on Windows?
I've done the necessary porting to make it compile, and installed WinUSB drivers (as per libusb), but claiming the interface when I want to stream returns an ERROR_NOT_SUPPORTED and if I hack to pick an interface that claims correctly, I get an ERROR_PIPE.
This is a Logitech C270 camera, running the example.cpp and test.cpp, and works perfectly on Linux using the same computer.
Thanks!
-SJ
The text was updated successfully, but these errors were encountered: