Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 25 Oct 2014, 04:45
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
Bluetooth & D-Bus, January 08
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 7 Posts_count   Goto page: 1, 2, 3, 4, 5, 6, 7 Next
Author Message
tempestuous

Joined: 10 Jun 2005
Posts: 5271
Location: Australia

PostPosted: Mon 31 Dec 2007, 07:04    Post_subject:  Bluetooth & D-Bus, January 08  

Note: The bluetooth libraries and utilities in this thread are compatible only with Puppy 3.x and 4.x.
For Puppy 2.x you must use the older ver 2.10 bluetooth libraries contributed by forum member debernardis here -
http://www.debernardis.it/dotpups/experimental_BT_1.pup
D-Bus is not required with these older libraries.

Recent versions of the bluetooth libraries need to bind to the D-Bus subsystem, and this has been problematic.
Forum member giac_fab mentioned that bluetooth works well under XFCE4.4.1, and with this clue I think I have worked out the problem.
D-Bus can be run using two different utilities; dbus-launch and dbus-daemon. I can now say that dbus-launch is no use for bluetooth, because it does not create the necessary PID file and socket file. You must use dbus-daemon to start D-Bus.
So here is how to get the bluetooth/dbus system running:

NOTE: Use the DBus/Bluetooth dotpets from this forum thread. These have been carefully configured with the correct configuration locations.
Other DBus/Bluetooth packages may not work.

First we need to get D-Bus running.
Code:
rm -f /var/run/dbus/*
dbus-uuidgen --ensure
dbus-daemon --system

Load all necessary bluetooth kernel modules -
Code:
modprobe bluetooth
modprobe l2cap
modprobe rfcomm
modprobe hci-usb

EDIT July 2010
In more recent kernels since Puppy 4.3, the hci-usb module has been replaced by the btusb module. Thus replace the last command with -
Code:
modprobe btusb


Now we need to run the Bluetooth Host Controller Interface daemon (hcid). But this process will fork to run in the background, which means that any errors will not be noticed. So it's a good idea to first do this
Code:
hcid -n

You should see something like this -
Code:
# hcid -n
hcid[3005]: Bluetooth HCI daemon
hcid[3005]: Created local server at unix:abstract=/var/run/dbus-it4nWAKmag,guid=f7d18acc9c2cb6e3385394004772417e

Now you know it looks OK, you can terminate the daemon with Ctrl>c, and hcid can be run without the -n switch.
Now start hcid, as well as the Bluetooth Service Discovery Protocol daemon (sdpd). Run these 2 commands -
Code:
hcid
sdpd

Bluetooth (and D-Bus) should now be up and running.
Forum member tantor reports that this command is necessary
Code:
hciconfig hci0 class 0x3e0100

but I found that OBEX file transfer works fine without it.

Now let's fix the configuration file. Open /etc/bluetooth/hcid.conf in geany.
Change "security auto" to "security user"
You will see that the default passkey is "BlueZ". Since this passkey will need to be entered into your mobile device, it's easier if the passkey is numeric, and I prefer to avoid "1234" since many mobile devices use this as a default value. I'm more confident that a connection is successful if it is made with a non-default value. So let's use "2345" for the following examples. Change "passkey "BlueZ";" to "passkey "2345";"

Now there's just one more thing to prepare: the passkey verification daemon. Run this command -
Code:
passkey-agent --default 2345 &

Once a bluetooth connection is successfully established for the first time, your mobile device registers the properties of the Puppy bluetooth connection with your Puppy computer, and passkey-agent is not needed for all subsequent connections.

Put your bluetooth device (mobile phone, PDA, etc) into "discoverable" bluetooth mode, then run this command to find its bluetooth MAC address -
Code:
hcitool scan

The result for my Motorola K1 is "00:17:E3:4B:68:A3"
Now query the capabilities of your device with -
Code:
sdptool browse 00:17:E3:4B:68:A3

Take note of the channel number which corresponds to the bluetooth service you want to use.
The 3 bluetooth services most likely to be useful are:

1) "Dial-up Networking Gateway"
(my Motorola's channel is 1)
This is for GPRS/EDGE connections to a mobile phone. See the HOWTO's by forum members daemon and debernardis here -
http://www.murga-linux.com/puppy/viewtopic.php?p=88286#88286
http://puppylinux.org/wikka/ExperimentalBT
Quick summary: Puppy is missing the necessary /dev/rfcomm0 device node, so create it -
Code:
mknod -m 666 /dev/rfcomm0 c 216 0

Now pair the computer to phone, specifying the correct channel for Dial-up Networking Gateway (channel 1 for me) -
Code:
rfcomm bind /dev/rfcomm0 00:17:E3:4B:68:A3 1

Now you need a GPRS chatscript to connect via /dev/rfcomm0

2) "SyncML Data Synchronisation" (or similar)
(my Motorola's channel is 12)
This is for calendar/organiser/addressbook exchange. See "HowTo sychronise J-Pilot with a Palm device via bluetooth" -
http://www.murga-linux.com/puppy/viewtopic.php?p=173442#173442
It's also possible, in theory, to synchronise to PocketPC/WindowsMobile devices, but I think that some extra libraries are required. John Doe knows more about PocketPC -
http://www.murga-linux.com/puppy/viewtopic.php?t=17440

3) "OBEX file transfer"
(my Motorola's channel is 9)
This is to copy files from/to your Puppy computer, initiated from Puppy. Quick HOWTO: run this command -
Code:
obexftp -b 00:17:E3:4B:68:A3 -l

It's also possible to specify the correct channel with the "-B" parameter (channel 9 in my case) but obexftp is smart enough to use the correct channel anyway.
Your phone will prompt you to enter the passkey we created earlier (2345), then the phone will ask you to accept "OBEX file transfer, Requested by: BlueZ (0)".
Puppy will then display a list of directories available on your phone in XML format. Let's say one of those directories is "audio". So to list files in this directory, do this -
Code:
obexftp -b 00:17:E3:4B:68:A3 -l /audio

Let's say you see a file called "mymusic.mp3". To get (or "fetch") this file, use the "-g" parameter, like this -
Code:
obexftp -b 00:17:E3:4B:68:A3 -g /audio/mymusic.mp3

Or to send ("put") a file to the phone, use the "-p" parameter.

If the file transfer is initiated from the phone, the process is different ... maybe I will test this some other time.

It may be possible to mount the phone as a filesystem using the obexfs dotpet package from later in this thread, but this will only work with certain phones. Install Obexfs-0.8.pet, then do this -
Code:
mkdir /mnt/bluetooth
obexfs -b 00:17:E3:4B:68:A3 -B 9 /mnt/bluetooth

If it works, you will now be able to browse files in the phone using ROX, or any other file manager.

Edited_times_total
Back to top
View user's profile Send_private_message 
tempestuous

Joined: 10 Jun 2005
Posts: 5271
Location: Australia

PostPosted: Mon 31 Dec 2007, 07:08    Post_subject:  

EDIT Feb 21 2008
DBus-1.0.2.pet repackaged to include the necessary directory: /var/run/dbus

Here are the dotpets. All of these packages have been compiled with the correct configuration locations:

/etc/bluetooth/hcid.conf
/etc/bluetooth/rfcomm.conf

/etc/dbus-1/session.conf
/etc/dbus-1/system.conf
/etc/dbus-1/system.d/bluetooth.conf

/var/run/dbus/
/var/lib/dbus/
/var/lib/bluetooth/

BlueZ-utils-3.24 includes the necessary /dev/rfcomm0 device node,
and additional "passkey-agent" utility.
I did not compile bluez-pin, because this requires gconf-2 and orbit2.
DBus-1.0.2.pet
Description 
pet

 Download 
Filename  DBus-1.0.2.pet 
Filesize  231.51 KB 
Downloaded  3389 Time(s) 
BlueZ-utils-3.24.pet
Description 
pet

 Download 
Filename  BlueZ-utils-3.24.pet 
Filesize  505.8 KB 
Downloaded  2848 Time(s) 
DBus-GLib-0.74.pet
Description 
pet

 Download 
Filename  DBus-GLib-0.74.pet 
Filesize  69.18 KB 
Downloaded  2972 Time(s) 
BlueZ-libs-3.24.pet
Description 
pet

 Download 
Filename  BlueZ-libs-3.24.pet 
Filesize  31.57 KB 
Downloaded  2658 Time(s) 
BlueZ-firmware-1.2.pet
Description 
pet

 Download 
Filename  BlueZ-firmware-1.2.pet 
Filesize  67.02 KB 
Downloaded  2574 Time(s) 

Edited_times_total
Back to top
View user's profile Send_private_message 
tempestuous

Joined: 10 Jun 2005
Posts: 5271
Location: Australia

PostPosted: Mon 31 Dec 2007, 07:09    Post_subject:  

hcidump is optional.
BlueZ-hcidump-1.40.pet
Description 
pet

 Download 
Filename  BlueZ-hcidump-1.40.pet 
Filesize  75.13 KB 
Downloaded  1906 Time(s) 
Back to top
View user's profile Send_private_message 
tempestuous

Joined: 10 Jun 2005
Posts: 5271
Location: Australia

PostPosted: Mon 31 Dec 2007, 07:11    Post_subject:  

Here is OpenOBEX & ObexFTP, needed to transfer files via bluetooth.

Update Feb 14 2008: ObexFS added. This allows the bluetooth device to be mounted, so files can be browsed like those on any other filesystem.
Note that OpenOBEX still needs to be installed as well.

The official instructions at http://dev.zuckschwerdt.org/openobex/wiki/ObexFs
look complex. Forum member jockjunior explains a more straigtforward mounting process -
Code:
mkdir /mnt/bluetooth  ## this only needs to be done the first time
obexfs -b <phone address> -B <bluetooth channel> /mnt/bluetooth

Now you can access files on the bluetooth device at /mnt/bluetooth
Openobex-1.3-apps.pet
Description 
pet

 Download 
Filename  Openobex-1.3-apps.pet 
Filesize  34.45 KB 
Downloaded  1891 Time(s) 
Obexfs-0.8.pet
Description 
pet

 Download 
Filename  Obexfs-0.8.pet 
Filesize  9.47 KB 
Downloaded  1859 Time(s) 
Obexftp-0.20.pet
Description 
pet

 Download 
Filename  Obexftp-0.20.pet 
Filesize  51.91 KB 
Downloaded  1944 Time(s) 

Edited_times_total
Back to top
View user's profile Send_private_message 
tempestuous

Joined: 10 Jun 2005
Posts: 5271
Location: Australia

PostPosted: Mon 31 Dec 2007, 07:16    Post_subject:  

Here are the Bluetooth-alsa libraries and utilities.
These are for bluetooth headset connections. Of course, the bluez and dbus libraries posted earlier in this thread are also required.
Refer to http://bluetooth-alsa.sourceforge.net/build.html for instructions.
In summary;
For high quality one-way connections in stereo for listening to music,
with either xmms or VLC, use the a2dpd utility.
This package provides the necessary .a2dprc and .asoundrc configuration files in /root

For 2-way connections, the SCO alsa plugin method will probably crash the Puppy kernel,
so you must use the btsco kernel driver method described in the "Legacy drivers" section.
For this, you will need to install the Bluetooth-alsa-btsco package compatible with your Puppy version.
There is a good HOWTO on this technique over at the DamnSmallLinux forum by Juanito -
http://damnsmalllinux.org/cgi-bin/forums/ikonboard.cgi?act=ST;f=37;t=18382;hl=bluetooth
Bluetooth-alsa-sbc+plugz.pet
Description 
pet

 Download 
Filename  Bluetooth-alsa-sbc+plugz.pet 
Filesize  178.72 KB 
Downloaded  1713 Time(s) 
Bluetooth-alsa-btsco-k2.6.18.1.pet
Description  for Puppy ver 2.12-2.16
pet

 Download 
Filename  Bluetooth-alsa-btsco-k2.6.18.1.pet 
Filesize  16.03 KB 
Downloaded  1275 Time(s) 
Bluetooth-alsa-btsco-k2.6.21.7.pet
Description  for Puppy ver 3.x
pet

 Download 
Filename  Bluetooth-alsa-btsco-k2.6.21.7.pet 
Filesize  17.74 KB 
Downloaded  1440 Time(s) 
Back to top
View user's profile Send_private_message 
shenen

Joined: 03 Dec 2006
Posts: 39

PostPosted: Sun 13 Jan 2008, 14:14    Post_subject:  

When I type scid -n, I got this message:

hcid[16679]: Bluetooth HCI daemon
hcid[16679]: Can't open HCI socket: Address family not supported by protocol (97)

Not sure what went wrong. I have installed those 5 dotpups that you mentioned.
Back to top
View user's profile Send_private_message 
tempestuous

Joined: 10 Jun 2005
Posts: 5271
Location: Australia

PostPosted: Sun 13 Jan 2008, 21:26    Post_subject:  

Thanks for reporting shenen.
I just tested these commands in a fresh boot to the Puppy 3 CD, and yes, you're right. It's a shame that none of the other 30-or-so people who downloaded these packages reported this problem.

I did some quick testing, and I see that the "rfcomm" module needs to be loaded before the "hcid -n" command will work, so I have just amended the instructions so that the process is performed in a slightly different order. Please try again.
Back to top
View user's profile Send_private_message 
shenen

Joined: 03 Dec 2006
Posts: 39

PostPosted: Sun 13 Jan 2008, 22:43    Post_subject:  

tempestuous,
I tested and it went ok. Thanks.

you've contributed a lot to package the applications to make it easy to run so that not every one who uses Linux has to be that technical.

Everytime when I searched what I need, you name shows up all over the places.

Without these easy to install .pet packages, I wouldn't use this distro.

It's me who should thank you.
Thanks,
Shenen
Back to top
View user's profile Send_private_message 
tempestuous

Joined: 10 Jun 2005
Posts: 5271
Location: Australia

PostPosted: Sun 20 Jan 2008, 01:50    Post_subject:  

Forum member malcom_f reports that for audio support Bluez-utils must be compiled with "--enable-audio".
So I have just recompiled BlueZ-utils-3.24 and re-attached the dotpet above. I used this configuration:

./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --libexecdir=/lib --enable-inotify --enable-expat --enable-usb --enable-alsa --enable-obex --enable-glib --enable-audio --enable-input --enable-serial --enable-network --enable-sync --enable-echo --enable-hcid --enable-sdpd --enable-hidd --enable-pand --enable-test --enable-cups --enable-manpages --enable-configfiles --enable-initscripts --enable-pcmciarules --enable-bccmd --enable-avctrl --enable-hid2hci --enable-dfutool --enable-dfubabel

... and I just compiled J-Pilot with bluetooth support, details here -
http://www.murga-linux.com/puppy/viewtopic.php?t=25604
Back to top
View user's profile Send_private_message 
shenen

Joined: 03 Dec 2006
Posts: 39

PostPosted: Tue 05 Feb 2008, 09:15    Post_subject:  

I run the same thing again, but it shows something new:

dmesg, it shows:

hci_scodata_packet: hci0 SCO packet for unknown connection handle 92

228 lines of them.

The only difference is that I downloaded the new compiled BlueZ-utils-3.24

and hcid -n shows:

# hcid -n
hcid[4474]: Bluetooth HCI daemon
hcid[4474]: syntax error line 32

not sure what that means.
Back to top
View user's profile Send_private_message 
tempestuous

Joined: 10 Jun 2005
Posts: 5271
Location: Australia

PostPosted: Thu 07 Feb 2008, 03:34    Post_subject:  

shenen wrote:
... dmesg, it shows:
hci_scodata_packet: hci0 SCO packet for unknown connection handle 92

According to this link -
http://www.think-future.de/wiki/index.php?title=Bluetooth
that error message is related to bluetooth audio connections, which is not surprising since the revised version of Bluez-utils now has audio features enabled.
It may be related to the "sco" module, so if you load the sco module, the error message might go away. But I think the error is trivial, anyway.


shenen wrote:
hcid[4474]: syntax error line 32

I think this relates to the hcid configuration file /etc/bluetooth/hcid.conf
Line 32 of this file is normally -
Code:
name "BlueZ (%d)";

Did you maybe change this line?
Back to top
View user's profile Send_private_message 
Béèm


Joined: 21 Nov 2006
Posts: 11782
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

PostPosted: Thu 07 Feb 2008, 06:16    Post_subject:  

tempestuous

Thank you for reviving BT.

This command dbus-uuidgen --ensure when executed says dbus-uuidgen not found.
Is this important?
I can run the dbus daemon however.

I still get somewhat lost in things like hci, rfcomm and tools like hcitool and sdptool.

I followed this thread and could do an upload with the x command.
I didn't find yet to do a download and change the directory location on the phone.

Having with my usb-bt stick a nice gui program I installed it in Wine, but the bt device isn't seen in wine.
Is there something special to do?

I try in alpha 6 and in muppy 008 also.

Also I have a 3.9 pet for bluez utils and libs.
You reference 3.24. Which one should be taken?

EDIT:
When I try to use obexftp the phone ask to add the pc device (as Bluez) and I say yes.
Then an access code is asked. I try to use the one of the phone, but that doesn't match.
Is there a fixed access code in Bluez and which one is it?
Or is there way to set an access code in Bluez?

_________________
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
Consult Wikka
Use peppyy's puppysearch
Back to top
View user's profile Send_private_message 
tempestuous

Joined: 10 Jun 2005
Posts: 5271
Location: Australia

PostPosted: Thu 07 Feb 2008, 08:02    Post_subject:  

Béèm wrote:
This command dbus-uuidgen --ensure when executed says dbus-uuidgen not found.
Is this important?

Maybe not so important, but it reveals that you are not using my DBus/Bluetooth dotpets.
All earlier bluetooth packages available on the forum failed to bind to DBus, and then hcid failed to work properly. So it's important to use the versions from this thread.

Béèm wrote:
I still get somewhat lost in things like hci, rfcomm and tools like hcitool and sdptool.

Follow the exact order I explained in the first post of this thread.

Béèm wrote:
Having with my usb-bt stick a nice gui program I installed it in Wine, but the bt device isn't seen in wine.
Is there something special to do?

I don't know. I imagine that getting hardware devices to work under emulation is difficult. Does Wine use Windows drivers? Or does Wine translate driver commands from Windows into Linux?

Béèm wrote:
Also I have a 3.9 pet for bluez utils and libs.

Not possible. As of today Feb 7th 08 the current version is 3.25
http://www.bluez.org/download.html
But whatever version you have, I suggest you change to my packages, because the DBus-Bluetooth linking is critical to success.

Regarding your obexftp questions, I have no experience with this. You should ask giac_fab or JohnDoe.
Back to top
View user's profile Send_private_message 
Béèm


Joined: 21 Nov 2006
Posts: 11782
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

PostPosted: Thu 07 Feb 2008, 08:47    Post_subject:
Sub_title: Bluetooth in Wine 0.9.51
 

Quote:
Béèm wrote:
Having with my usb-bt stick a nice gui program I installed it in Wine, but the bt device isn't seen in wine.
Is there something special to do?

I don't know. I imagine that getting hardware devices to work under emulation is difficult. Does Wine use Windows drivers? Or does Wine translate driver commands from Windows into Linux?
I indeed installed the windows drivers that came with the USB stick.
But the USB stick isn't seen by them.

Advice was given, that I should go into the device manager of Wine (like in Windows), but there is no such thing.

However I can go on the internet in Wine without having installed something special, so I suppose the WiFi support of Puppy is used.

I'll continue looking and if I find something, I'll post here.

_________________
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
Consult Wikka
Use peppyy's puppysearch
Back to top
View user's profile Send_private_message 
Béèm


Joined: 21 Nov 2006
Posts: 11782
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

PostPosted: Thu 07 Feb 2008, 09:07    Post_subject:  

Quote:
Béèm wrote:
Also I have a 3.9 pet for bluez utils and libs.
Tempestuous wrote:
Not possible. As of today Feb 7th 08 the current version is 3.25
Well here is where I got them:
http://www.murga-linux.com/puppy/viewtopic.php?mode=attach&id=3927
and
http://www.murga-linux.com/puppy/viewtopic.php?mode=attach&id=3928

And here is the post I got them from:
http://www.murga-linux.com/puppy/viewtopic.php?p=115474#115474

But I will uninstall them and install yours as they match maybe better the other stuff.

_________________
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
Consult Wikka
Use peppyy's puppysearch
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 7 Posts_count   Goto page: 1, 2, 3, 4, 5, 6, 7 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1318s ][ Queries: 13 (0.0149s) ][ GZIP on ]