Bluetooth at boot

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

Bluetooth at boot

Postby flyinghappy » Tue Jul 30, 2013 8:36 pm

So I have a bluetooth keyboard and mouse on my Pi and they are working fantastically. The only thing I am having trouble with is getting them to connect at boot. After I reboot the Pi I have to either ssh in or use a USB keyboard to bring my device up using $this->bbcode_second_pass_code('', 'hciconfig hci0 up') It would be nice if I didn't have to do this each time. It only gets rebooted when the kernel updates other than that it stays on most of the time, so not a show stopper but a pain in the butt none the less. Anybody have any ideas on how to get hci0 to be up at boot?
flyinghappy
 
Posts: 12
Joined: Thu Nov 01, 2012 10:10 pm

Re: Bluetooth at boot

Postby moonman » Tue Jul 30, 2013 8:48 pm

systemctl enable bluetooth
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: Bluetooth at boot

Postby flyinghappy » Tue Jul 30, 2013 8:59 pm

Already did that, but I still have to run $this->bbcode_second_pass_code('', 'hciconfig hci0 up') to get the dongle to work. I may have to do another reboot and see if it is just going to take a few to work...
flyinghappy
 
Posts: 12
Joined: Thu Nov 01, 2012 10:10 pm

Re: Bluetooth at boot

Postby jawbonegroove » Thu Aug 01, 2013 5:56 am

hey, you're one step ahead of me...i'm just about to try a hardline jump to bluetooth for basic peripherals. let me know what you figure out?

i figured i'd need to make an initial ramdisk with bluetooth modules loaded in [hooks] or possibly [binaries].

possibly a more failsafe solution would be to add your command line there to .bashrc
jawbonegroove
 
Posts: 6
Joined: Sat Jun 29, 2013 2:50 am

Re: Bluetooth at boot

Postby moonman » Thu Aug 01, 2013 6:16 am

.bashrc is only executed when you login. I'm actually looking into it now as I want a bluetooth PAN setup when raspberry boots up so I can control it from my phone in the car.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: Bluetooth at boot

Postby jawbonegroove » Thu Aug 01, 2013 6:50 am

oh, i thought it ran at the login prompt. there is the option of automatically logging in to a default account though, eh? especially for automotive applications?

what about adding it to hooks or binaries in /etc/mkinitcpio.conf?
jawbonegroove
 
Posts: 6
Joined: Sat Jun 29, 2013 2:50 am

Re: Bluetooth at boot

Postby flyinghappy » Thu Aug 01, 2013 4:52 pm

ok, so here is what I did. I used bluetoothctl to pair/connect/trust my mouse and keyboard using the archwiki. I enable bluetooth.service at boot. then I wrote this custom service...

bluetooth-up.service
$this->bbcode_second_pass_code('', '[Unit]
Description=Bring Up Bluetooth
After=bluetooth.target

[Service]
Type=oneshot
ExecStart=-/usr/local/bin/hciconfig hci0 up
TimeoutSec=0
StandardInput=tty
RemainAfterExit=yes

[Install]
WantedBy=bluetooth.target')

this made it work great. as for logging in automatically, you can do wo so with slim, the /etc/slim.conf is pretty well outlined for doing it if you open it and look around. (slim is for a gui though, don't know if you'd be booting into X or not...)
flyinghappy
 
Posts: 12
Joined: Thu Nov 01, 2012 10:10 pm


Return to Raspberry Pi

Who is online

Users browsing this forum: Majestic-12 [Bot] and 3 guests