usb_claim_interface() on Raspberry Pi - linux

I'm trying to get a USB HID device to work on Raspberry Pi.
The code utilizes the RawHID lib for MacOSX/Linux/Windows.
I got it working on MacOSX, but for other reasons I can't use it on that OS anymore. Now I'm trying to get it to work on Raspberry Pi via hid_LINUX.c.
When I tried it out, it just completely fails to connect. I added the debug info, and found out it's failing here:
if (usb_claim_interface(u, i) < 0) {
printf(" unable claim interface %d\n", i);
continue;
}
I tried googling for ages and I see various things about...
modprobe.d blacklist (didn't work, although that looked for for rtl devices... not sure)
updating all packages (didn't work)
compiling your own version of libhid (I don't know why I'd have to do this, considering the creator of the USB device recommended this RawHID lib which uses libusb-dev (usb.h), and which works fine on OS X and Windows)
Does anyone have any possible ideas how I can proceed? How do I 'free' my USB device so I can claim it?
I have a Raspberry Pi B+

Apparently I can not comment (insufficient reputation) so I answer instead:
I finally found the reason for my problem with the comment "Now I solved it by just running the code with sudo rights" above, so I'm grateful!
I use a Pi 3b for Domoticz for > 3 years. (same software on PC before that) After a failed update, followed by a complete re-install, my CM15 Domoticz interface (connected via USB) would be recognized as present with lsusb, but would not work. I boot my PI from a USB key, so maybe the -very old- USB key failed, so I bought a new USB 3.0 key. No joy. USB 3.0 uses more power, maybe draining USB power from my CM15, so I bought a bigger supply. Did not solve the problem.So I bought a new memory card, no change.
Searching for "usb_claim_interface failed -6 mochad" brought me here for a correct diagnostic and the way to make it work "manually"
Not yet the solution; normally libusb starts the "interface" software (mochad) when it finds a new USB device connected, but "claiming it" apparently now requires more permissions. Now that I understand the problem, I'll find the answer.
Thanks much for showing the way dennis-tra!

Related

PulseAudio Bluetooth Speaker crash on Raspberry Pi

I just bought a JBL speaker, tested it on my phone and proceeded with this tutorial on my Raspberry Pi:
https://www.raspberrypi.org/magpi/bluetooth-audio-raspberry-pi-3/
I managed to pair and trust the speaker, but I can't connect to the device from bluetoothctl, only from audio settings.
Problem is, most of the times it doesn't work. I've managed to have audio for 3 seconds in a timespan of ... 4 hours.
This is where PulseAudio crashes:
E: [pulseaudio] bluez4-util.c: org.bluez.Manager.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method "GetProperties" with signature "" on interface "org.bluez.Manager" doesn't exist
I've tried a lot of things from forums, nothing worked.
Thank you for your help!
I had a similar problem, but then I used a USB bluetooth adaptor for connecting to my speaker, and now I get a nice stable connection all the time.
I can't be 100% sure that this will fix your problem, but give it a try. It seems that the built in bluetooth adaptor for rasp Pi 3 isn't great. I used an Asus adaptor, but if you need to buy one, you can find a list of the officially supported adaptors # https://www.raspberrypi.org/.
Stephen

Linux Bluez Bluetooth overload?

I am working with a Raspberry Pi (running Jessie), Bluez, and iBeacons (10 iBeacons). My application (written in Python) sniffs for iBeacons and reports MAC address and RSSI. This is a continuous "sniff". The program can run for hours without any overload; however, after introducing a virtual iBeacon (from an iPhone app), the application seems to "overload" not allowing the application to be able to read the other non-virtual iBeacons forcing me to restart the Pi. Also, the virtual iBeacon is transmitting at MUCH faster rates as compared to the other iBeacons. Regardless, this poses a deployment problem as we cannot afford to have a rogue Bluetooth signal overloading the system.
Is this an issue with Bluez, the USB dongle (Iomega), or something else? Not posting code to the forum- interested in where to start looking for an issue. Not sure where to begin.....
Sorry for the vagueness. Was not sure if the issued was in Linux Bluetooth stack, Raspberry Pi, dongle, or elsewhere.
Switched out the Broadcom dongle with a Cambridge Silicon Radio and have eliminated all errors.
Thanks!

Raspberry Wifi configuration

English is not my mother language, but I hope you can understand me. I have bought a Raspberry Pi 2. I installed Raspbian and I bought a Wifi too. This one:
http://www.ebay.com/itm/271857752471?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
I'm new too use Raspberry and I've never use Raspbian and other 'Linux' distribution... So, my biggest problem is, that raspberry doesn't recognize my wifi. I've tried to download this package: http://driver.iigoal.com/drivers/SKU108764.rar
I've tried to do what is in the guide, but I can't... Perhaps can somebody write down a description (or a short video:)), how I need to do these things?
The WiFi adapter listing on eBay does not list Linux as a compatible OS, but it lists the driver as being Realtek RTL8192cu.
I researched a little about that driver in regards to raspbian and it should have two potential drivers. the first is built into the kernel/base installation. It's module is named 8192cu.ko.
A second option exists, though it appears to be a bit experimental that comes from an RTLwifi set.
Since this is a fresh installation, I would recommend starting fresh and ensuring that the WiFi dongle is plugged in during the Raspbian installation/first boot. This should ensure that it is identified and loaded properly.
If that does not work, I would recommend plugging in the rPi 2 with an ethernet cable and running updates to the system, that may help download anything it identifies as missing or old and other greater compatibility
Plug-in the wifi adapter to a usb port,open up a terminal on Raspberry pi and type
lsusb
it will display all the usb devices in the system.
if there is an entry for your wifi adapter then it is easy to make it work.
my raspberry pi work with hardware what you bought in eBay, without more configuration as: wifi-data in wpa-supplicant, if you use terminal:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
and write
network={
ssid="NETWORK_NAME"
psk="NETWORK_PASSWORD"
}
this is normal rule for wifi configuration in raspberry pi

Unable to connect Arduino to NVIDIA Jetson TK1 dev board

I have been trying to pass serial communications between the Jetson and an Arduino Nano, and have discovered that the Jetson will not provide the Arduino with a serial port (should be something like ttyACM0). lsusb in the terminal doesn't identify an Arduino, instead, it lists a generic "Future Technology Devices International" USB serial device. My assumption is that there is a driver issue, but I can find no helpful information for installing or even finding any drivers. Any help would be greatly appreciated.
I eventually got this to work, using this tutorial. I had tried it before, couldn't get past the Configuring the kernel section. Having tried it again in desperation yesterday, it worked fine. I must not have been paying attention!
Just install the current version of the "grinch" kernel, this custom kernel
has the drivers included.
find more info on the Nvidia dev forum:
grinch kernel

Cannot program Atmega1284p with arduino on linux, works on mac

This issue is driving me nuts. I am working on a project with some other guys who built the electronics. We have custom boards with an atmega 1284p. For USB cummunication with the 1284p we use a FTDI FT230X USB Bridge. This doesn't have DTR; RTS is used to reset the board using a capacitor (pretty much like with off the shelf arduinos).
The arduino bootloader is used, and we use mighty-1284p to upload. The board selected is "Original Mighty 1284p 8MHz". After installing the right FTDI drivers from http://www.ftdichip.com/Drivers/VCP.htm I can upload to the board from a mac. Linux has these drivers built into the kernel. However, I cannot upload to the board. AVR gives the following error:
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30] [20]
dmesg gives the following:
...
[ 51.299964] usbcore: registered new interface driver ftdi_sio
[ 51.300088] ftdi_sio 1-1.2:1.0: FTDI USB Serial Device converter detected
...
and lspci:
...
Bus 001 Device 006: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
...
The settings for the mac and linux machine are identical. On both I use arduino 1.0.5. Both do see the correct serial port.
I've seen many posts in this forum with similar problems, but have yet to find one with a solution that works for me. Holding reset, or clicking it just before uploading does not work. As suggested in some forums I have tried with removing brltty to no avail. I have tried uploading with the Arduino IDE, Eclipse with AVR plugin and AVR via command-line. None will work. I've tried it on different machines as well with different versions of ubuntu, and uploading works in none of them. Adding -c arduino to avrdude command doesn't do the trick either. Any ideas on how to fix this?
My user is part of the dialout group, and I can upload to other arduino boards (like duemilanove) without problems.
This question was originally asked here: http://forum.arduino.cc/index.php?topic=244363
You mentioned Ubuntu; are you doing this as a normal user?
If so, you may need to add your account to the correct group, the serial port device belongs to.
You can do that like this:
sudo usermod -a -G dialout yourself
then (easiest) logout and log back in again.
However, it is possible that it is called something other than dialout in the latest Ubuntu, I haven't checked. I can confirm it is still dialout here on Debian Wheezy.
(this is a little odd, though, if it works; usually you get a permission error instead...)
I know this is quite an old question, but in addition to the dialout group problem I've had issues with ModemManager interrogating anything that looks like a serial port (and screwing up programmers in particular because they're not expecting those bytes). I don't know if that's what's happening in your case but it's worth a shot for others who end up here.
I just removed it entirely (which is a large hammer, probably temporarily disabling it is best...):
sudo apt-get remove modemmanager
If you want to try disabling it, maybe:
sudo systemctl stop ModemManager.service

Resources