Bluetooth on Raspberry Pi Zero W, using buildroot - bluetooth

I'm trying to get the onboard Broadcom bluetooth working in a Buildroot 2017.08 built linux on the Raspberry Pi Zero W. It's not showing me the adapter. Bluetooth USB dongles do work.
Things I've already done:
Added rpi-bt-firmware
Added Bluez-tools and Bluez5-utils
Kernel compiled with all sorts of Bluetooth support
Loaded bluetooth modules: bluetooth, bnep, btbcm, hci_uart
rfkill list (shows no bluetooth devices)
rfkill unblock bluetooth (just in case)
After boot I'm manually starting bluetoothd followed by bluetoothctl.
when I type "power on", "list" or "show" it does not give me any bluetooth controllers.
The hardware is working, on the same system I have Debian Jessie working fine with the bluetooth.
Also, given that USB bluetooth dongles work, I think the kernel is OK too.
What could possibly be the problem here??
Anything I could try to troubleshoot??
Anything I could install or add to make it work??
Anything is welcome at this point! :)
UPDATE
I have it working by running hciattach /dev/ttyAMA0 bcm43xx 921600 flow - at start-up. However, I have barely a clue what's going on here. Proper explanation will count as an answer.
I have also removed console=/dev/ttyAMA0 from the cmdline.txt, not sure though if that was necessary.

hciattach attaches serial HCI devices via UART to Bluez stack https://www.systutorials.com/docs/linux/man/8-hciattach/.
In your case the serial Broadcom HCI adapter is at /dev/ttyAMA0, so the command your run attaches it to Bluez as a bcm43xx HCI adapter.
Its probably done the same in your Debian Jessie setup.

Related

Bluetooth dongle BLED112 on Debian 10 is not working

I just randomly found a Bluegiga BLED112 Bluetooth dongle and I tried to connect it to my Debian 10 laptop as a basic dongle for Bluetooth audio outs.
Unfortunately I wasn't able to solve all the issues I had, starting from the fact that the device is not fully listed once used lsusb and just a mere ID number - namely ID 2458:0001 - pops out and bluetooth or bluez helps weren't successful either.
This given, I tried to follow several of the guides you can find online, also by running available scripts, but again nothing worked.
So if it's possible, what should I do in order to run such a dongle for the basic use I mentioned above - i.e. just for connecting my stereo speakers to my computer?
Thanks
The BlueGiga BLED112 is not a regular Bluetooth USB dongle. It gives you a virtual com port that can be used to access an API that in turn acts as a BLE device.
It is ment to be used for development of IOT solutions.
Also it does not support Bluetooth Classic, it only supports Bluetooth Low Energy.

How can I prevent linux from initializing a USB HID device

I have a USB HID device that can work in two different modes. The selection of modes is based on the sequence of USB enumeration/initialization packets sent to it.
I am using a Raspberry Pi 3 running Raspbian, however I also see the same issue if I compile my code for my desktop Ubuntu distro.
The issue I have is that linux is recognizing the USB device as a HID device and then sending the sequence of commands that it deems necessary to start the device, and this works correctly and starts the device in "Mode 1".
However I need to start the device in "Mode 2" and to do this I need to send a slightly different set of enumeration/initialization commands.
I am new to linux but very experienced with LibUSB and LibUSBDotNet under windows and can get the behavior I desire under windows.
Windows has similar behaviour to linux in that it will enumerate, recognise the device as a USB HID device and then initialise it as it deems fit resulting in the device going into "Mode 1". To prevent windows doing this I can create a LibUSB filter driver for the device, which then replaces the default driver, so windows will now do the initial enumeration, realise that the VID and PID of the device are managed by the LibUSB filter driver (rather than the windows HID driver) and then stop enumeration/initialization - this allows my code to take over and complete the initialization into "Mode 2".
How can I stop Linux from fully enumerating/initializing this device (as I do with windows). Perhaps I need to do something with udev rules or something, but I would have no idea what as I am new to linux.
Any help greatly appreciated
you have right, you have to play with the udev rules.
First of all you have to identify your device. Find the idProduct and the idVendor of your device. You can use:
lsusb
Then in the rules.d folder (/etc/udev/rules.d) create a new file with the name:
10-my-usb.rules
In this file add this line
SUBSYSTEM=="usb",ATTRS{idVendor}=="XXXX", ATTRS{idProduct}=="XXXX", MODE="666", GROUP+="plugdev"
Replace the XXXX with the value you get before
Then restart your udev rules:
sudo udevadm trigger
Then unplug and replug normally you can use it

Raspberry PI - RT2870 (kernel module mt7601Usta) WiFi SUB dongle - Act as WiFi access point

I have a problem with USB WiFi dongle RT2870 on Raspberry Pi. This is KOM0640 (Quer) model, successfully detected by Linux Kernel mt7601Usta.ko module.
Specification of my Raspberry:
Latest Linux Raspbian distro with kernel 3.12.35+
WiFi dongle 148f:7601 Ralink Technology, Corp.
WiFi dongle is successfuly detected and can be used as client (connect with available access points).
My problem is to switch this USB WiFi dongle to AP (access-point) mode and enable HotSpot mode on Raspberry Pi. Here is result of iwconfig - I've tried to set access point mode by hand from command line:
root#raspberrypi:~/# iwconfig wlan0 mode master
Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; Invalid argument.
I have read a lot of web pages with a lots of hints, but without success.
If you have any positive results on this issue, please let me know.
Thanks in advance!
Mediatek drivers dont support nl80211 and cant be used with hostapd.
Original drivers from mediatek.com site doesnt contain AP function. You have to compile driver from eywalink github repo.
After compiling/installing driver you can insert mt7601uap module and configure AP settings in /etc/Wireless/RT2870AP/RT2870AP.dat
You need a driver that supports master mode. You can get one from https://github.com/muratdemirtas/MT7601u. Good luck

Wifi won't stay up on BeagleBone

I'm running Ubuntu 11.10 on a BeagleBone with an Edimax EW-7711UAn wifi adapter plugged into the USB port. I've configured /etc/network/interfaces and the wifi works, BUT:
The wlan0 interface doesn't always come up when booting the device. It comes up successfully about one in three attempts.
The interface sometimes goes down again, especially when not used for a while.
The /etc/network/interfaces file includes:
auto wlan0
iface wlan0 inet dhcp
wpa-driver wext
wpa-ssid "Bodoni"
wpa-psk "<mypassword>"
In order to try to address point 1), I put the following in /etc/rc.local:
nohup sh -c "ifdown wlan0 && ifup wlan0"
But it hasn't seemed to help much. I'm guessing that the second problem might be connected with power management, so I might try turning that off in /etc/rc.local.
But does anyone have any thoughts on how I might get the wifi to come up reliably on boot? I'm running the BeagleBone headless with no Ethernet (it's on a robot) so it's important I get this fixed!
FYI, I'm using the default drivers - lsmod gives:
Module Size Used by
aes_generic 27837 2
arc4 1111 2
rt2800usb 12386 0
rt2800lib 45146 1 rt2800usb
crc_ccitt 1457 1 rt2800lib
rt2x00usb 10595 1 rt2800usb
rt2x00lib 39077 3 rt2800usb,rt2800lib,rt2x00usb
mac80211 228509 3 rt2800lib,rt2x00usb,rt2x00lib
cfg80211 167722 2 rt2x00lib,mac80211
rfkill 16703 1 cfg80211
binfmt_misc 6224 1
spidev 4620 0
I'm hoping not to have to compile a new driver because I haven't had much success with that!
I've had a similar problem with my BeagleBones using another wifi adapter using the rt2800usb driver. Specifically I am using a DLINK DWA-125 (HW Rev A2) which is based on the rt3070 chip.
Same exact symptoms that you are reporting if I plug the DWA-125 directly into the USB port on the BeagleBone.
BUT if I plug the adapter into a USB extension cable and then plug the extension cable into the BeagleBone USB port, everything works fine. I have done 100s of hours of Cloud9 development using this setup and no problems with Wifi whatsoever.
I am running the Angstrom distro - and I find the same issue on all three of last BB releases (4/22. 5/? and 6/18).
Length of USB extension cable doesn't seem to matter (at least between 1ft and 12ft - haven't tried anything below 1ft.)
I have 6 BeagleBones (4 ver A5 and 2 ver A6) - behavior is the same on all of these Beaglebones.
Also have 4 DWA-125 Rev A2 USB adapters - behavior is the same on all of these.
I have not experimented with other USB Wifi Adapters using the same or other chips/drivers. And I haven't spent the time to track down the root cause of this behavior - I have code to write!
But, give it a try in case your experience matches mine - its a quick and easy 'fix'.
---- Addendum:
I just tried an experiment with the Belkin N150 Micro USB Wifi Adapter - based on the rtl8192cu chip and the standard drivers that come with the 6/18 BeagleBone Angstrom distribution.
Got very similar behavior: The Wifi doesn't work at all when plugged directly into the USB port. But when plugged in via a 1ft USB extension cable, everything works fine.
I had the same problem. The best explanation i've found so far is this one from Adafruit
The main idea is that the Wifi dongle is destructed by the HDMI adapter, that is situated just under the USB slot. You have two workarounds in this case:
Put the Wifi-dongle as far as possible from the USB-slot by means of a cable
Disable the HDMI interface if you don't really need it!
Only the second option helped me.
Here are the steps:
> mkdir /mnt/boot
> mount /dev/mmcblk0p1 /mnt/boot
> nano /mnt/boot/uEnv.txt
Remove the # in front of the cape_disable command
##Disable HDMI
cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
I hope it will help you guys!
I've fixed the problem by removing the USB ESD spike protection IC (U10, TPD4S012). It should be wired between the USB connector and the CPU but it was placed after the USB connector on my board (rev. A4). I don't know if this is fixed on later revisions.
Update: this won't help much in some cases. Check this thread.
I had a similar problem for most of a year until I googled long enough to find
wicd
After setting things up with wicd my 5 beaglebones have been rock solid on my home network on wifi dongles from the back bedroom to the garage. /etc/network/interfaces is not the way to go. I must have tried hundreds of configurations and some seemed to last for a day or two. I do remember the doc gave a good default for interfaces, very barebones. And wicd runs your supplicant if ever needed.
It took me ages to get reliable WiFi on the BeagleBone. In the end, the answer was to use an Atheros dongle, since I had poor luck with RealTek and RALink chipsets. The NetGear WNA1100 works very reliably for me, in both Angstrom and Ubuntu. See my post here.

Bluetooth Module Appears Not to Be working

I've built a Buildroot linux image for my PhidgetSBC and included bluetooth support unfortunately it appears my bluetooth USB dongle isn't working. Although I have not tested it with code it's internal LED does not illuminate when I plug it in.
When I issue lsmod I see this:
Module Size Used by Not tainted
usb_storage 33699 -
btusb 8560 -
bluetooth 50130 -
It appears bluetooth is in the kernel but how could I test my usb dongle?
This is definitely not Buildroot related, but rather hardware and kernel configuration rleated. Unfortunately, you're giving way too few details: which Bluetooth USB dongle you're talking about, what kernel version using, what is your kernel configuration, etc.
First of all, check if your USB device appears when running lsusb.

Resources