Closed joefly888 closed 10 years ago
relevant dmesg log:
ming - can you run 'lsmod' after plugging in the wedo? I suspect the 'hiddev' kernel module is blocking python's use of the usb device. scratch may unload the module on start.
someone else ran into a similar problem, also on raspbian: http://unix.stackexchange.com/questions/55495/prevent-usbhid-from-claiming-usb-device
It looks like the solution is to add a udev rule to flag the device as not an input device.
I built a test rule, uploaded at http://itdaniher.com/p?UltH.
To try it out, run:
sudo wget -O /etc/udev/rules.d/wedomore.rules http://itdaniher.com/p?UltH
and reboot.
ian, tried this and same error, and did reboot
I am having the same "resource busy" error. I am running Ubuntu 14.04. my error looks like this.
from wedo import WeDo wd = WeDo() Traceback (most recent call last): File "
", line 1, in File "/usr/local/lib/python2.7/dist-packages/wedo-1.0.0-py2.7.egg/wedo/init.py", line 62, in init self.dev.set_configuration() File "usb/core.py", line 559, in set_configuration self._ctx.managed_set_configuration(self, configuration) File "usb/core.py", line 92, in managed_set_configuration self.backend.set_configuration(self.handle, cfg.bConfigurationValue) File "usb/backend/libusb1.py", line 741, in set_configuration _check(self.lib.libusb_set_configuration(dev_handle.handle, config_value)) File "usb/backend/libusb1.py", line 571, in _check raise USBError(_str_error[ret], ret, _libusb_errno[ret]) usb.core.USBError: [Errno 16] Resource busy
I'll work to get my hands on a WeDo soon, haven't the hardware to debug now.
You can get error 16 if your udev rule isn't correct. This works for me on Ubuntu 14.04
Remove the WeDo cable from the computer then type
sudo gedit /etc/udev/rules.d/99-legousb.rules
Right click in gedit and paste in this text.
# WeDo dialout rule
SUBSYSTEM=="usb", ATTRS{idVendor}=="0694", ATTRS{idProduct}=="0003", GROUP="dialout", MODE="0666"
then save and exit gedit. Also make sure you are in the dialout group, then reboot to make sure the groups and udev rules are active.
sudo adduser your_user_name dialout
sudo reboot
I tend to use the dialout group as that is where similar usb<>serial adapter type things also end up by default, but you could use any group you are a member of.
I have done this and am still getting the same error.
Please run lsof | curl --http1.0 -F "content=<-" itdaniher.com/p
and paste the resulting URL. lsof shows all open programs and the executable with lock.
Thanks, Ian
@Hephaestos Have you installed libhid, and if so is it grabbing the WeDo? Check with:
sudo lsusb -t
If so you can release the device using
sudo libhid-detach-device 0694:0003
Hi,
I have this rule:
UBSYSTEMS=="usb", ATTRS{idVendor}=="0694", ATTRS{idProduct}=="0003", GROUP="robots", MODE="0660"
And I in the group "robots".
Wich version of PyUSB are you using?
I found the problem. The code try set a configuration before dettach kernel driver! I fix that in my fork (i send a pull request with that and another things). Please test it.
I've merged Alan's work on WeDoMore into master. It should behave the same, as well as work nicely on OLPC XO linux distros. Once someone can confirm that moving the detach to before the configuration set solves the issue at hand, then this issue can be closed.
AlanJAS, great work, this now works for me on RPI. Thanks Guys, and to ian for the original work
using code on raspberry Pi Rev B rev1,2
confirm works with Scratch on Rpi out of the box, Have done new install of raspbian and also powered hub seen others having similar problem on pi
erroor code
pi@raspberrypi ~ $ sudo python Python 2.7.3 (default, Mar 18 2014, 05:13:23) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.