Close

Bluetooth Adventure

A project log for Pi-Print

A cheap Bluetooth printer for ugly prints.

muthMuth 01/22/2015 at 09:591 Comment

Bluetooth and RaspberryPi:

Fortunately, a lot of Bluetooth USB keys are supported by the Raspbian linux distribution. Some Goggling and you find how to install it:

It starts with the installs :

sudo apt-get install bluetooth bluez obexpushd

Followed by the config.

sudo hciconfig hci0 name "my_funny_name"
This is to change the name seen by the other devices when scanning.

sudo hciconfig hci0 piscan
This is to make it discover-able

sudo bluetooth-agent -c NoInputNoOutput 1234
This is to make it pair-able with the code "1234" and with no confirmation on the raspberry side. (I found it's quite hard to find information on bluetooth-agent command line option...)

sudo obexpushd -B -o /home/pi/project/piprint/
And finally start the file server, which auto accept file and save them in the specified folder.

To make it each time after boot, I edited the /etc/rc.local file. By adding these lines:

sleep 2
sudo bluetooth-agent -c NoInputNoOutput 1111 &
sleep 2
sudo hciconfig hci0 piscan &
sleep 2
sudo obexpushd -B -o /home/pi/project/piprint/ &
sleep 2
cd /home/pi/project/piprint/bin
sudo java -classpath .:/home/pi/project/piprint/lib/'*' piprint.Launcher

exit 0

Last lines are to launch the printer program, that I'll describe a bit later.

Discussions

scidoot wrote 08/14/2018 at 13:40 point

Hi muth, 

Id appreciate it if you could help me here:

Been trying to get obexpushd running on boot for a couple days, found your tut and still not working!!

I edited rc.local:

sudo obexpushd -B -o '/home/pi/files' &

exit 0

What could be the reason for failure in my case? its a very simple script. btw when I enter the same in terminal everything works fine

thx in advance 

scidoot

  Are you sure? yes | no