On Wed, Jan 23, 2019 at 12:01 AM Jeffrey Nichols wrote:
>
> Isuue 1: This is normal for python scripts. You can easily uninstall and
> reinstall the package to revert your changes.

Just to add to what Jeff wrote: The library files can be -rw-r--r--
which means they are writeable for owner (root in this case), and
readable for everybody. They don't need any executable bit. They are
very likely correct in the Debian package.

> Issue 2: The permission errors have nothing to with the script or
> library permissions, only the USB device. You cannot fix the /dev/
> permissions through chmod, so don't try.
>
> With pyusb properly installed, you should be able to run via sudo and
> have everything work. This will prove that everything is working, then
> you just need to figure out how to grant your user USB device access.
> The usual way is to add the user to the 'usb' group, but I've had a lot
> of success with targeted udev rules for specific devices.

In general, use lsusb to list your devices, and identify the vendor
and product IDs (4+4 hex digits, like 1a2b:3c4e). Then make a rule
like this (filename must end in .rules), replacing 1a2b and 3c4e with
your device IDs:

# Example udev rules (usually placed in /etc/udev/rules.d)
# Makes USB device writeable for the "plugdev" group and the console user
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="1a2b",
ATTRS{idProduct}=="3c4e", MODE="664", GROUP="plugdev", TAG+="uaccess"

If your system doesn't have a "plugdev" group you can remove the
GROUP="plugdev" element. All modern distros will work fine with just
the uaccess tag. The mode 644 will make the device node under
/dev/bus/usb/*/* be -rw-r--r--.

However, only now did I take a closer look at the USB descriptor dump
in your original e-mail: You are trying to access a USB hub. The hub
is already claimed by the operating system, the USB drivers in the
kernel. It is the same for USB keyboards, USB drives etc. It is normal
that you get permission problems or busy errors. There are ways to
release a device from the kernel but that is probably not what you
want to do. Only for devices without any kernel driver you can expect
to be able get access using libusb and pyusb.

Tormod


> On 1/22/2019 5:15 PM, charles wilson wrote:
> > ok, I took on board your comment about install python3-usb which
> > includes pyusb.
> > I reinstalled the raspbian OS and installed python3-usb  ... it puts
> > the files in quite different places, but the same files.
> >
> > Issue 1) again a number of files (e.g.
> > 'usr/lib/python3.5/dist-packages/usb/backend/libusb1.py = the
> > 'insufficient permissions' problem installed with permission "Execute
> > = Nobody" .... again this did not seem right so I changed it and the
> > other permissions
> >
> > Issue 2) same error, just a different file location
> > File "/usr/lib/python3/dist-packages/usb/backend/libusb1.py", line
> > 595, in _check
> >     raise USBError(_strerror(ret), ret, _libusb_errno[ret])
> > usb.core.USBError: [Errno 13] Access denied (insufficient permissions)
> >
> > I can't see what I have done wrong in repeated installations and
> > attempts to fix on different OS and hardware.
> >
> > BTW Tormod & Jeffery I had not ignored your comments re
> > /dev/bus/usb/*/* but there was little in there and I fixed the
> > permissions with no change.
> > With the re-install the files again loaded with 'execute = nobody' & I
> > changed that.
> > This time there was a change when running the script
> >
> > File "/usr/lib/python3/dist-packages/usb/backend/libusb1.py", line
> > 595, in _check
> >     raise USBError(_strerror(ret), ret, _libusb_errno[ret])
> > usb.core.USBError: [Errno 16] Resource busy
> >
> > which is an error beyond my experience
> >
> > also BTW I installed python2.7-usb after I had no joy with v3 ....
> > same result


_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to