groupgets / purethermal1-uvc-capture

USB Video Class capture examples for PureThermal 1 / PureThermal 2 FLIR Lepton Dev Kit
125 stars 81 forks source link

uvc_open error #7

Closed ShuangjunLiu closed 5 years ago

ShuangjunLiu commented 6 years ago

I tried to run code uvc_deviceinfo.py uv_radiometry.py

Both has error "uvc_open error" I checked the code. It seems that PT_USB_VID and PT_USB_PID is not defined when call res = libuvc.uvc_find_device(ctx, byref(dev), PT_USB_VID, PT_USB_PID, 0)

I find out my device ID image

as
VID: '1E4E' PID: '0100'

Transfer them into int format and put in the code.

Still same erro 'uvc_open error'

moscamich commented 5 years ago

check if the lepton sensor is well in place, I notified problem with the carrier board holder. Afterward try to run with sudo

mylesjoseph commented 5 years ago

sudo works - but is there a solution that does not involve sudo?

kekiefer commented 5 years ago

You can define udev rules to give regular users access to a usb device. This rule would give everyone rw access:

sudo sh -c "echo 'SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"1e4e\", ATTRS{idProduct}==\"0100\", SYMLINK+=\"pt1\", GROUP=\"usb\", MODE=\"666\"' > /etc/udev/rules.d/99-pt1.rules"
mylesjoseph commented 5 years ago

I am still seeing uvc_open error - do I have to modify anything to that script?

kekiefer commented 5 years ago

What OS are you using?

mylesjoseph commented 5 years ago

Ubuntu 16.04.5 LTS xenial

kekiefer commented 5 years ago

It should work, but OS support is getting a bit out of scope here.

Check that the permissions on the usb device are actually being set by udev. lsusb will give you the bus and device number -- look for it in /dev/bus/usb/*/*. If the rule is working properly, you'll see the device mode is crw-rw-rw- (the last rw is what you're looking for this to work as a non-privileged user). A one-liner to list all the device permissions:

find /dev/bus/usb/*/* -exec ls -l {} \;
pellarboss commented 4 years ago

Took me a while to figure this out.

I had to set LD_LIBRARY_PATH for it to work export LD_LIBRARY_PATH='/usr/local/lib'

Hope this helps the next guy :)

techmaticsnz commented 4 years ago

I'm currently getting the same error on raspbian stretch. PT_USB_VID=0x1E4E PT_USB_PID=0x0100

init works find device works uvc_open error sudo doesn't work.

Unique part of the system is that two cameras are running through libuvc. however If i stop the other camera the error still persists. Can anyone help or point me in right direction? output of ls crw-rw-rw- 1 root root 189, 6 Apr 16 00:15 /dev/bus/usb/001/007

output of lsusb Bus 001 Device 007: ID 1e4e:0100 Cubeternet WebCam

sayezz commented 4 years ago

I have the same error on windows 10 using Visual Studio 2017. Changed my hardware ids: PT_USB_VID=0x1E4E PT_USB_PID=0x0100

Tryed to execute as admin. -> Device found ->uvc_open: "Not found (-5)".

luv-deluxe commented 4 years ago

I ran into this issue, but running app using sudo has made it working.

getandplay commented 3 years ago

I have the same error on windows 10 using Visual Studio 2017. Changed my hardware ids: PT_USB_VID=0x1E4E PT_USB_PID=0x0100

Tryed to execute as admin. -> Device found ->uvc_open: "Not found (-5)".

I have the same issue, have you fixed that? @mudzin Could you share your solution, thank you.

sayezz commented 3 years ago

@getandplay what are you trying to do? It has been a while so I need to work myself back into the code. If you try to get the pure thermal running under windows, let me know, I can probably provide you a working code/VS project that you can use.

getandplay commented 3 years ago

@sayezz Yeah, I am trying to make it running under windows. That would be very nice if you could share your code. Thank you.

sayezz commented 3 years ago

I send you an e-mail with the source code. Long ago I thought about doing a PR but I do not find the time to kind of sort the project out and make a stand alone version without all the other non cam related stuff.

ghost commented 2 years ago

@sayezz I have the same problem, can you send me your solution if you still have it? thanks a lot!

sayezz commented 2 years ago

@PostalDude I send you an e-mail with the source code. Let me know if thats enough or if you need more help.

sayezz commented 2 years ago

well... your mail is not valid PostalDude

ptrba commented 1 year ago

https://raspberrypi.stackexchange.com/questions/135418/how-do-i-set-permissions-on-a-dev-bus-usb-node solved this issue for me. See also https://forums.raspberrypi.com/viewtopic.php?t=186839 and https://raspberrypi.stackexchange.com/questions/125091/how-to-create-a-linux-user-group-that-grants-access-to-usb-devices for more hints on setting permissions of your USB devices on linux.

criminact commented 1 year ago

@postaldude I send you an e-mail with the source code. Let me know if thats enough or if you need more help.

Hey, I am stuck with the same problem and getting -5 from the uvc_open() function. Is this a permission issue? or something else?

I am working on windows 11. Building my application on QT. Thanks in advance. I wouldn't mind the source code that you have sent to other people. Thanks.

sayezz commented 1 year ago

Hey @criminact , I worked only on Windows 10, might be that there a some differences between Win 10 and 11. Anyways, can you see the PR (https://github.com/groupgets/purethermal1-uvc-capture/pull/60)? Here you can find my modified code.

Reharding the -5, I don't know exactly where this is coming from. Did you check the VIDs in the device manager for the cameras? Might be that your IDs are different and therefore you need to adjust the code and set PT_USB_VID to the correct address. This is just a guess but the IDs in the code and the device manager should match.