"failed to open this device: LIBUSB_ERROR_ACCESS" on ubuntu16.04, have tried some solutions - linux

After searching for long time on internet I think there is no proper answer so I put up this problem. As being new here, I apology if I made any mistakes.
I have a tof camera connected to ubuntu16.04 through usb and a software to operate it. When I try to receive the image through software:
./smartTOFViewer
it gives these error repeatedly:
2018/07/06 20:27:20.297[3249948416][DBG] [dmcam_dev_open] open dmcam device # 0x7f8ab88e29c0
2018/07/06 20:27:20.297[3249948416][DBG] [_usb_ll_dev_open] create usb context
2018/07/06 20:27:20.300[3249948416][ERR] [dmcam_dev_open] open device failed!
2018/07/06 20:27:21.301[3249948416][DBG] [dmcam_dev_open] open dmcam device # 0x7f8ab88e29c0
2018/07/06 20:27:21.301[3249948416][DBG] [_usb_ll_dev_open] create usb context
2018/07/06 20:27:21.303[3249948416][ERR] [dmcam_dev_open] open device failed!
2018/07/06 20:27:22.304[3249948416][DBG] [dmcam_dev_open] open dmcam device # 0x7f8ab88e29c0
2018/07/06 20:27:22.304[3249948416][DBG] [_usb_ll_dev_open] create usb context
2018/07/06 20:27:22.307[3249948416][DBG] [_usb_ll_dev_open] found dmcam device (speed=3) # 001:002:020
2018/07/06 20:27:22.307[3249948416][WRN] [_usb_ll_dev_open] failed to open this device: LIBUSB_ERROR_ACCESS, try next ...
2018/07/06 20:27:22.308[3249948416][ERR] [dmcam_dev_open] open device failed!
but if I run this command:
sudo ./smartTOFViewer
it works normally. So I think it's a permission issue, and create a udev rule file:
sudo nano /etc/udev/rules.d/99-persistent-usb.rules
and content:
SUBSYSTEMS=="usb",ATTRS{idVendor}=="111b", \
ATTRS{idProduct}==1238",GROUP="root", OWNER="root", \
MODE="0666"
The idVendor and idProduct are checked with:
$ lsusb
Bus 001 Device 002: ID 8087:8001 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 006: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
Bus 002 Device 005: ID 8087:07dc Intel Corp.
Bus 002 Device 004: ID 064e:920b Suyin Corp.
Bus 002 Device 003: ID 046d:c530 Logitech, Inc.
Bus 002 Device 021: ID 111b:1238
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
I also tried setting something:
GROUP="dongtu" or "adm" or "usrs" or "plugdev",
OWNER="dongtu" or just removing it,
adding TAG+="uaccess",
putting in one line and remove " \"
I run this command for reload:
sudo udevadm control --reload
However, all these make no change. I observed that there is no change under /dev/ when I connect the tof, but I failed to figure out why.
I hope to do my job in anaconda with python, which means I can't use sudo in case run under system python environment. Is there any one could help me? Apologize again if I wasted your time.

Related

openvino crashes after running inference some seconds in raspberry pi 4

I tried to use Intel Neural Compute Stick 2 as an inference engine for my smart car.
I installed l_openvino_toolkit_runtime_raspbian_p_2019.2.242.tgz followed by this link, and run the code for testing.
Everything was fine at the beginning of 10 - 20 seconds(sometimes less, sometimes longer), Then crashed with the following errors:
E: [xLink] [ 327401] [EventRead00Thr] dispatcherEventReceive:336 dispatcherEventReceive() Read failed (err -4) | event 0xaf1fdddc XLINK_READ_REL_REQ
E: [xLink] [ 327401] [EventRead00Thr] eventReader:223 eventReader thread stopped (err -4) E: [xLink] [ 327402] [python3] XLinkReadDataWithTimeOut:1323 Event data is invalid
E: [ncAPI] [ 327402] [python3] ncFifoReadElem:3445 Packet reading is failed. terminate called after throwing an instance of 'InferenceEngine::details::InferenceEngineException'
what(): Failed to read output from FIFO: NC_ERROR
Aborted
I tried to insert it into the USB hub with a self-power adapter, but it still got the same errors.
I also tried to insert it into the USB2.0, but still not working.
I checked out the dmesg, I found the Intel Neural Compute Stick 2 will be auto-mounted when I called net.forward() at some point.
I got dmesg information by following steps:
check the ncs2 device is ok(I can find the device) before running the code.
clear dmesg
running the code
waiting for it crashed. then, check out the dmesg.
the dmesg showing:
[87255.685160] usb 1-1.1: USB disconnect, device number 25
[87255.831256] usb 2-1: new SuperSpeed Gen 1 USB device number 18 using xhci_hcd
[87255.861963] usb 2-1: New USB device found, idVendor=03e7, idProduct=f63b, bcdDevice= 1.00
[87255.861970] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[87255.861975] usb 2-1: Product: VSC Loopback Device
[87255.861980] usb 2-1: Manufacturer: Intel Corporation
[87255.861985] usb 2-1: SerialNumber: 41440410119541BC00
[87280.181479] usb 1-1.1: new high-speed USB device number 26 using xhci_hcd
[87280.312042] usb 1-1.1: New USB device found, idVendor=03e7, idProduct=2485, bcdDevice= 0.01
[87280.312048] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[87280.312053] usb 1-1.1: Product: Movidius MyriadX
[87280.312058] usb 1-1.1: Manufacturer: Movidius Ltd.
[87280.312063] usb 1-1.1: SerialNumber: 03e72485
[87280.691784] usb 2-1: USB disconnect, device number 18
My environment is:
Raspberry Pi 4 (4GB)
Raspbian Buster
I have debugged it serval days, but have no idea to solve this problem.
Is there anything I missed?
Thanks!
The error seems to be related to the NCS2 device being reset for inference and fail to initialize during runtime. Verify you have added the USB Rules for the Intel® Neural Compute Stick 2 device by performing the following steps.
Add the current Linux user to the users group:
$ sudo usermod -a -G users "$(whoami)"
Log out and log in for it to take effect.
Run setupvars.sh again after logging in:
$ source /opt/intel/openvino/bin/setupvars.sh
Install the USB rules running the install_NCS_udev_rules.sh script:
$ sh /opt/intel/openvino/install_dependencies/install_NCS_udev_rules.sh
Proceed to run the demo application:
$ python3 SingleStickSSDwithUSBCamera_OpenVINO_NCS2.py
Note the l_openvino_toolkit_runtime_raspbian_p_2019.2.242 is now quite outdated, and there have been newer software packages released. Checkout the OpenVINO™ Toolkit packages storage for the most recent release available (at the time of this post, 2021.4.1 - l_openvino_toolkit_runtime_raspbian_p_2021.4.689.tgz).
I've executed the demo application you listed with OpenVINO 2021.4.1 for longer than 10 minutes and the error can't reproduce:

Cannot open /dev/video0 (No such device)

I am trying to install a webcam on a Synology NAS (arm, linux kernel 3.2.40).
I have compiled and installed the kernel modules, they seem to work. This is the kernel output when inserting the modules and plugging the camera (Logitech C270):
[ 130.963903] Linux video capture interface: v2.00
[ 136.098356] usbcore: registered new interface driver uvcvideo
[ 136.104135] USB Video Class driver (1.1.1)
[ 145.384393] usb 3-2: new high-speed USB device number 4 using etxhci_hcd_150119
[ 145.628583] uvcvideo: Found UVC 1.00 device USBDevice (046d:0825)
[ 145.726156] input: USBDevice as /devices/pci0000:00/0000:00:00.0/usb3/3-2/3-2:1.0/input/input0
This is the lsusb output:
# lsusb
libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Function not implemented
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 004: ID 046d:0825 Logitech, Inc. Webcam C270
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
However, I cannot access the camera:
# v4l2-ctl --all
Failed to open /dev/video0: No such device
in strace:
open("/dev/video0", O_RDWR) = -1 ENODEV (No such device)
I have tried different camera model, the C270 on another computer (works fine), deleting /dev/video0 and re-creating it (mknod /dev/video0 c 81 0), changing permissions, etc. but I get the same error...
crw-rw-rw- 1 root video 81, 0 Jun 14 12:07 /dev/video0
lsmod shows that uvcvideo is not used for the camera:
# lsmod
Module Size Used by
uvcvideo 57657 0
videodev 72561 1 uvcvideo
usbcore 147080 7 ehci_hcd,etxhci_hcd,usb_storage,usblp,usbhid,uvcvideo
usb_common 592 1 usbcore
Any ideas?

How to configure embedded-linux USB?

Why doesn't this correctly configure file_storage device USB?
On the embedded-linux target:
/ # modprobe g_file_storage file=/dev/mmcblk0
musb_hdrc: version 6.0, cppi-dma, peripheral, debug=0
musb_hdrc: USB Peripheral mode controller at fec64000 using DMA, IRQ 12
g_file_storage gadget: File-backed Storage Gadget, version: 20 November 2008
g_file_storage gadget: Number of LUNs=1
g_file_storage gadget-lun0: ro=0, file: /dev/mmcblk0
/ # lsusb
lsusb: /sys/bus/usb/devices: No such file or directory
/ # cat /lib/modules/2.6.32-17-ridgerun/modules.dep | grep usb
kernel/drivers/usb/otg/nop-usb-xceiv.ko:
kernel/drivers/usb/musb/musb_hdrc.ko: kernel/drivers/usb/otg/nop-usb-xceiv.ko
kernel/drivers/usb/gadget/g_file_storage.ko: kernel/drivers/usb/musb/musb_hdrc.ko kernel/drivers/usb/otg/nop-usb-xceiv.ko
On the Ubuntu 10.04 host:
$ fgrep USB $DEVDIR/kernel/linux*/.config | grep -v '^#'
CONFIG_USB_SUPPORT=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_MUSB_HDRC=m
CONFIG_USB_MUSB_SOC=y
CONFIG_USB_MUSB_PERIPHERAL=y
CONFIG_USB_GADGET_MUSB_HDRC=y
CONFIG_USB_TI_CPPI_DMA=y
CONFIG_USB_GADGET=m
CONFIG_USB_GADGET_VBUS_DRAW=2
CONFIG_USB_GADGET_SELECTED=y
CONFIG_USB_GADGET_DUALSPEED=y
CONFIG_USB_FILE_STORAGE=m
CONFIG_USB_OTG_UTILS=y
CONFIG_NOP_USB_XCEIV=m
$ lsusb
Bus 002 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 002 Device 002: ID 8087:0024
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 058f:6362 Alcor Micro Corp. Hi-Speed 21-in-1 Flash Card Reader/Writer (Internal/External)
Bus 001 Device 004: ID 04ca:003a Lite-On Technology Corp.
Needed usb_composite_msd_acm.patch (solved with help from RidgeRun).

AVRISP MKII doesn't work with AVRDUDE on Linux

The system sees something is plugged in when I plug and unplug it:
bluehat#Matapan:/dev$ tail -f /var/log/syslog
Mar 23 15:36:35 Matapan kernel: [156082.112874] usb 7-1: new full speed USB device using uhci_hcd and address 6
Mar 23 15:47:19 Matapan kernel: [156726.248081] usb 7-1: USB disconnect, address 6
Mar 23 15:47:29 Matapan kernel: [156736.200148] usb 6-1: new full speed USB device using uhci_hcd and address 3
AVRISP MKII should rely on cdc-acm:
bluehat#Matapan:/dev$ modinfo cdc-acm -V
module-init-tools version 3.12
So it should be able to see it just fine, and yet I am unable to write to it.
avrdude -p m1280 -c avrispmkII -P usb -U test.hex
Returns
avrdude: usb_open(): cannot read serial number "error sending control message: Operation not permitted"
avrdude: usb_open(): cannot read product name "error sending control message: Operation not permitted"
avrdude: usbdev_open(): error setting configuration 1: could not set config 1: Operation not permitted
avrdude: usbdev_open(): did not find any USB device "usb"
It turns out that Ubuntu will acknowledge that the object is there but not play nicely with it until you fix up some of your udev rules. Thanks to http://steve.kargs.net/bacnet/avr-isp-mkii-on-ubuntu-hardy/ which provided files that only needed a little updating.
Create new file /etc/udev/avrisp.rules
SUBSYSTEM!="usb", ACTION!="add", GOTO="avrisp_end"
# Atmel Corp. JTAG ICE mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2103", MODE="660", GROUP="dialout"
# Atmel Corp. AVRISP mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2104", MODE="660", GROUP="dialout"
# Atmel Corp. Dragon
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2107", MODE="660", GROUP="dialout"
LABEL="avrisp_end"
Now create a virtual link to the file and give it a rule priority
cd /etc/udev/rules.d
sudo ln ../avrisp.rules 60-avrisp.rules
Check you're in the dialout group
groups
Restart udev
sudo service udev restart
Hooray!
For Ubuntu 12.04, there's a minor change that must be carried out to the configuration that Katy posted:
All occurrences of SYSFS should be replaced with ATTR
Additionally, if you're still having problems, make sure you have installed all the required dependent libraries. I found that I had to install the uisp package as well.
If restarting udev doesn't make a difference, unplugging the programmer and plugging it in back in does.
Updated rule that works for 13.10:
SUBSYSTEM!="usb", ACTION!="add", GOTO="avrisp_end"
# Atmel Corp. JTAG ICE mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2103", MODE="660", GROUP="dialout"
# Atmel Corp. AVRISP mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2104", MODE="660", GROUP="dialout"
# Atmel Corp. Dragon
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2107", MODE="660", GROUP="dialout"
LABEL="avrisp_end"
Based on previous posts about changes.
Seems they changed it again in 12.10
The Subsystem is now "usb"
I found a command which shows what you need.
For that you just need to know the Bus and Device number from the plugged device
(use lsusb)
Bus 003 Device 010: ID 03eb:
lsusb
So my Bus number from the isp is 003 and Device is 010
(edit the end /003/010 to your needs)
udevadm info --attribute-walk --name=bus/usb/003/010
shows among many other things
SUBSYSTEM=="usb"
ATTR{idVendor}=="03eb"
ATTR{idProduct}=="2104"
Replace/change the created rule above and everything should work
If there are other Problems the Command will show them to you, it checks the rules (found a typo that way :))
If there is no error it won't show anything (Didn't realise for some time)
I used the following udev rules file to get it working on Fedora 19:
SUBSYSTEM!="usb", ACTION!="add", GOTO="avrisp_end"
# Atmel Corp. JTAG ICE mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2103", MODE="660", GROUP="dialout"
# Atmel Corp. AVRISP mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2104", MODE="660", GROUP="dialout"
# Atmel Corp. Dragon
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2107", MODE="660", GROUP="dialout"
LABEL="avrisp_end"
As you can see, some minor things are different from what is suggested above. Also I had to restart the computer. Using "udevadm control --reload" was not enough.

Hacking USB devices: Any programs out there?

I would like to (A) run something under windows to eavesdrop on the communication between a USB device and windows, so I can then (B) write something to communicate with the USB device, under Linux. Can anybody recommend a program to do (A)?
Your best bet for watching USB traffic on Windows is Snoopy Pro which is based on USB Snoopy.
Once you move over to implementing your driver for Linux, you will want to make sure that usbmon is enabled in your kernel so you can get at the same information on your Linux box.
Make sure your kernel includes the necessary components:
$ cat /boot/config-`uname -r` | grep -P "CONFIG_USB_(MON|DEVICEFS)
CONFIG_USB_DEVICEFS=y
CONFIG_USB_MON=y
Mount the usbmon file system and make sure there is stuff in the usbmon directory:
$ sudo mount -t debugfs none_debugs /sys/kernel/debug
$ ls /sys/kernel/debug/usbmon/
0s 0u 1s 1t 1u 2s 2t 2u 3s 3t 3u 4s 4t 4u 5s 5t 5u 6s 6t 6u
Use lsusb to find the bus number of the device you are interested in:
$ lsusb
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 045e:00d1 Microsoft Corp. Optical Mouse with Tilt Wheel
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 0a5c:2110 Broadcom Corp. Bluetooth Controller
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Start listening on the bus of your choice (I am listening on bus 4 below):
$ sudo cat /sys/kernel/debug/usbmon/4u > ~/Desktop/usbmon.txt
Stop collecting data with Control-C.
You can try:
usbsnoop
and
usbsnoopy
usbmon: http://biot.com/blog/usb-sniffing-on-linux

Resources