Bluetooth & D-Bus, January 08

Core libraries and systems
Message
Author
tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#21 Post by tempestuous »

Beem, don't be too disheartened. You are a pioneer in the area of bluetooth in Puppy. The road is likely to be bumpy!

When I compiled the DBus dotpets, I didn't realise that John Doe had already provided a dotpet with the same name (dbus-1.0.2.pet) -
http://www.murga-linux.com/puppy/viewto ... 474#115474
I have just edited my first post to emphasize the importance of using my latest DBus/Bluetooth dotpets.
Béèm wrote:

Code: Select all

dbus-uuidgen --ensure
# dbus-daemon --system
Failed to start message bus: Failed to bind socket "/var/run/dbus/system_bus_socket": No such file or directory
OK, we should be able to fix that. I compiled these DBus/Bluetooth packages in Puppy 3, which already has /var/run/dbus
but apparently you are using Puppy4, which does not have this directory. So let's create it -

Code: Select all

mkdir /var/run/dbus
EDIT Feb 21 2008
DBus-1.0.2.pet repackaged to include the necessary directory: /var/run/dbus
Last edited by tempestuous on Thu 21 Feb 2008, 09:14, edited 1 time in total.

John Doe
Posts: 1681
Joined: Mon 01 Aug 2005, 04:46
Location: Michigan, US

#22 Post by John Doe »

...John Doe...
i'm still out here and keep following this thread. perhaps i can contribute some thought at some point.

working on scripting the building of all my packages right now. it's a huge pain.

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#23 Post by Béèm »

Tempestuous wrote:OK, we should be able to fix that. I compiled these DBus/Bluetooth packages in Puppy 3, which already has /var/run/dbus
but apparently you are using Puppy4, which does not have this directory. So let's create it -
Code:

Code: Select all

mkdir /var/run/dbus
Now try again.
Tempestuous,
Sorry if I sounded a bit harsh, but I am glad I can pioneer a bit, with the extra 'burden' of Puppy 4. :wink:

Back to business.
Creating the directory did the trick.
I can use hcitool and sdptool commands.

But when I select on the phone (a Sony-Ericsson K700i) to scan for devices on bluetooth, a device Bluez (0) is found
Good sign probably.
But when I want to add this device to 'my devices' on the phone, I am asked for a, access code.
I give the one to start the phone, but that one isn't accepted.
So I have the feeling the Bluez support somewhere has an access code to be verified.
I tried 0000, 1234, 9999, 0 to no avail.
I don't know even how many positions it should have.
Do you know that one?

I then tried obexftp
But none of the commands execute.
I get the message:
Scanning...........
then after awhile:
Using 00:16:20:19:E8:89 K700i
Failed to connect to SDP server: File descriptor in bad shape.

I then tried obexftpd -b K700i
The message comes on the PC: Waiting for connection.....
When I try to initiate transfers from the phone to the PC, the phone finds the Bluez (0) device, wants to connect to it and asks again the access code.
As I don't have the correct one, I have to abandon.

But I am feeling, that if I had the correct code, I would be able to do much more.

So it is important to find that access code.
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#24 Post by tempestuous »

Béèm wrote:I can use hcitool and sdptool commands.
OK, at that point DBus and Bluetooth are up and running. Until I buy a new phone with bluetooth, that's as much as I know.
Béèm wrote:when I select on the phone (a Sony-Ericsson K700i) to scan for devices on bluetooth, a device Bluez (0) is found
Good, your phone can see the computer. "Bluez" is the device name specified in /etc/bluetooth/hcid.conf, and "0" is the device ID.
You can change that name if you wish.

Now some more pioneering is required to go further!

giac_fab gives instructions to copy files here -
http://www.murga-linux.com/puppy/viewto ... 653#155653
These commands are particularly interesting -

Code: Select all

dbus-send --system --dest=org.bluez /org/bluez/hci0 \ # this line make pc visibile
org.bluez.Adapter.SetMode string:discoverable # this line make pc visibile
sleep 3
hciconfig hci0 class 0x3e0100 # this line seems not be load automaticaly from hcid.conf
I think that at some stage a bluetooth PIN will be required. In an earlier post giac_fab talked about creating a script which echoes the PIN, then he specified this script as the "pin_helper" in the configuration file /etc/bluetooth/hcid.conf -
http://www.murga-linux.com/puppy/viewto ... 534#139534
... but I found a good HOWTO here
http://www.gentoo.org/doc/en/bluetooth-guide.xml
which explains that "pin_helper" is only used with older versions of bluetooth-utils.
So it seems that the correct way to set the bluetooth PIN is either;

1. change the "passkey" line in /etc/bluetooth/hcid.conf
Then modify /etc/bluetooth/hcid.conf to include "security auto" (not "security user")

or 2. Use the "passkey-agent" utility (which I included as part of bluez-utils) like this -

Code: Select all

passkey-agent --default <mypinnumber>
or 3. Create a file /etc/bluetooth/pin which contains just your pin number. (??)

User avatar
mbutts
Posts: 230
Joined: Sat 11 Nov 2006, 13:36
Location: sitn on an iceburg waiting for my next meal to swim by.

#25 Post by mbutts »

I've got a question concerning modprobe.

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

If you get bluetooth or any other device to work after doing modprobe and you shut down and save your work, will the device work the next time you reboot either if the device is plugged in during boot, or plug it in after the system has finished rebooting.
Can you think of modprobe as "loading a driver"?

I guess what I am asking is if you install all the librarys, and do a restart, will Linux modprobe and find all the modules automatically during boot or do you still need to type in modprobe from command prompt?

I'm still working on things like creating ACM0 and have had success from time to time with that and done the linking but am still not 100% clear in my mind what is going on. Hopefully at some point I will be able to finish adding hardware to my Puppy.
I have been working on a couple cell phones, Kyocera kx12 and Motorola Razr. I know some people have gotten Razrs to work in Linux but I'm not sure the kx12 will ever work. When I Look at USB devices with the Kyocera, it's always in red no matter what I try with modprobe even with vendor and device numbers after it. Today I am going to try to get the Razr to work, maybe with bluetooth. So far when using Puppy, I have been able to boot with the Razr plugged in and it starts charging through the USB cable. At least it has the second option of bluetooth connections.
One thing that I have noticed with cell phones is sometimes they get confused and you either have to shut them down or take the battery out to reset them.
I've been quietly reading threads on cell phones, bluetooth and file sharing between computer for quite some time and am slowly learning things.
I have IOgear gbu211 bluetooth dongles, and a Dlink dbt-120 that is supposed to be made for just Macs that I'm going to play with today with the Razr
I hope I haven't hijacked the thread, but when reading that it brought up a question I wanted to ask.
I see in another thread a newbie asked for a step by step on setting up bluetooth that keeps you from having 20 open tabs on your browser to see what everyone has said about it.
I'm not the brightest bulb on the tree most times, but I'm willing to keep trying till I get something working.
Thanks in advance for any comments on modprobe. :)
Oh btw, thx tempestuous, Beem, and all the rest of the members for all your posts on these topics.
Penguin, the OTHER white meat.
[url=http://www.puppyos.com][img]http://img293.imageshack.us/img293/5563/yxudnslbsx1jpglx3.png[/img][/url][img]http://i18.tinypic.com/2wd7o80.gif[/img]

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#26 Post by Béèm »

Tempestuous wrote:So it seems that the correct way to set the bluetooth PIN is either;

1. change the "passkey" line in /etc/bluetooth/hcid.conf
Then modify /etc/bluetooth/hcid.conf to include "security auto" (not "security user")

or 2. Use the "passkey-agent" utility (which I included as part of bluez-utils) like this -
Code:
passkey-agent --default <mypinnumber>

or 3. Create a file /etc/bluetooth/pin which contains just your pin number. (??)
For the moment I concentrate on the access code (pin number)
The passkey-agent doesn't seem to work, so I edited the referenced files by hand.
Don't know if I have to restart dbus, hcid etc..
Again the BlueZ (0) device is found and I try to pair giving the passkey I gave.
Still the same answer on my phone, 'access code doesn't match.
I launched hcidump so I see the activity.

Code: Select all

# hcidump
HCI sniffer - Bluetooth packet analyzer ver 1.40
device: hci0 snap_len: 1028 filter: 0xffffffff
> HCI Event: Connect Request (0x04) plen 10
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
> HCI Event: Command Status (0x0f) plen 4
> HCI Event: PIN Code Request (0x16) plen 6
< HCI Command: PIN Code Request Reply (0x01|0x000d) plen 23
> HCI Event: Command Complete (0x0e) plen 10
< HCI Command: PIN Code Request Negative Reply (0x01|0x000e) plen 6
> HCI Event: Command Complete (0x0e) plen 10
> HCI Event: Connect Complete (0x03) plen 11
I suppose > is traffic from the phone.
I conclude that the pin code given by BlueZ (0) to the phone is wrong for some reason.
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#27 Post by Béèm »

A supplementary question.
If the pin code is numeric does it has to be between double quotes in the hcid.conf and pin file?
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#28 Post by tempestuous »

Béèm and shenen,
I just posted a HOWTO for making a bluetooth connection from Palm devices to J-Pilot in Puppy.
http://www.murga-linux.com/puppy/viewto ... 442#173442
This HOWTO is only theory, from various pieces of information on the web.
You will see that it's necessary to create an RFCOMM connection, using this command -

Code: Select all

rfcomm connect 0 ...
Maybe this RFCOMM connection is necessary to copy files from phone?

User avatar
Whitesnow
Posts: 118
Joined: Tue 20 Nov 2007, 19:18
Location: Italy

BT password problem SOLVED

#29 Post by Whitesnow »

Hi everybody (why don't we say hello each other in forums and newsgroups? :wink: ), I hope that helps:

1. open a terminal and write

Code: Select all

passkey-agent --default <password that you want to set> <MAC ADDRESS of your device>
. It seems that nothing happens, but don't close the terminal, leave it alone and open another one.
2. In the new terminal, write

Code: Select all

rfcomm connect /dev/rfcomm0 <MAC ADDRESS of your device> <channel of your device>
.
3. Put the password in your device to pair and look in your first terminal. It should show

Code: Select all

Passkey request for device <MAC ADDRESS of your device>
After pairing, you can close this terminal, if you want.
4. If all went well, now in the second terminal you can read

Code: Select all

Connected /dev/rfcomm0 to <MAC ADDRESS of your device> on channel <channel of your device>
Press CTRL-C for hangup
Now you have established the connection. Enjoy! :D

Please, NOTE:

If you don't know MAC ADDRESS of your device or channel of your device, before start from point 1, open a terminal and write

Code: Select all

sdptool search dun
and in the line after the word "Inquiring", you can find a code (numer and letter) that is your MAC ADDRESS.
To find your channel, look in the line that start with the word "Channel".

Tempestous, please read, maybe useful. :)

You can also not insert in pet bluetooth and l2cap modules. When you modprobe and try to use rfcomm and hci_usb modules, rfcomm auto-creates bluetooth and l2cap modules.

From the first page, now. This code can't work because "bluetooth" is a directory. In the original thread, there's another one thing written (~ not >!), but I can't understand how mounting device dirs to the directory bluetooth. :?:
Tempestous wrote:

Code: Select all

mkdir /mnt/bluetooth  ## this only needs to be done the first time 
obexfs -b <phone address> -B <bluetooth channel> /mnt/bluetooth
Last thing: when you start hcid it seems that you don't need to insert

Code: Select all

hciconfig hci0 up
because I found in my logs that it's alredy up in a step when I launch my Internet script (that uses hcid first and then rfcomm and pppd).

Bye and THANK YOU for your hard work on BT. :D
[b][i][color=darkred][size=134]*.* Snow *.*[/size][/color][/i][/b] :wink:

tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#30 Post by tempestuous »

I now have a Motorola K1 mobile phone with bluetooth, so I tested the bluetooth commands and updated the instructions in the first post.

I also updated "HowTo sychronise J-Pilot with a Palm device via bluetooth" here -
http://www.murga-linux.com/puppy/viewto ... 442#173442

User avatar
Aitch
Posts: 6518
Joined: Wed 04 Apr 2007, 15:57
Location: Chatham, Kent, UK

#31 Post by Aitch »

Beem
Rather than continue under the other thread,
I hope this may shed some further light for you

http://www.murga-linux.com/puppy/viewtopic.php?t=18109

as it seems steevieb, with help from John Doe, has got his phone/bluetooth/gprs working

You have come so far, I didn't mean to be rude or upset you, just trying to help

OK?

Aitch

Edit:

http://www.bluez.org/
03.04.2008
Release of bluez-libs-3.30 and bluez-utils-3.30
This release fixes a regression within the D-Bus API and converts all services into plugins now.
http://wiki.bluez.org/

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#32 Post by Béèm »

Aitch,
I don't feel treated rude or I am not upset.
Sorry if you got that impression, in fact I appreciate much your willingness to help.

I just downloaded beta 2 and once installed it could be that I take the matter up again.
As I still use Windows ( :oops: ) and as it works there the priority isn't at the highest point.

But it's still on my to do list. 8)
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
Aitch
Posts: 6518
Joined: Wed 04 Apr 2007, 15:57
Location: Chatham, Kent, UK

#33 Post by Aitch »

OK, Cool

I had a bad experience with misunderstandings, & maybe felt a bit uncertain

May just be a language thing

Aitch :)

Cyberhythm
Posts: 2
Joined: Fri 02 May 2008, 21:10
Contact:

#34 Post by Cyberhythm »

Either there's a problem with the openobex .pet or I've got a sick puppy. The other packages install ok but that one comes up with an error message about a corrupted file or not expanding into its own directory.

Using puppy v4 beta 2 (for about a week now and most impressed with it's performance on this old Toshy sat pro 4600 with only 128mb).

tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#35 Post by tempestuous »

OpenOBEX package uploaded again, May 3rd 2008.

Cyberhythm
Posts: 2
Joined: Fri 02 May 2008, 21:10
Contact:

#36 Post by Cyberhythm »

Thanks Tempestuous,

Just gone through the steps again and I now have gpsdrive working using a cheap mikomi usb bluetooth dongle connecting to a navman b10 gps. I am now a happy puppy :) so thanks to you and everyone else who has contributed on this topic.

Caneri
Posts: 1513
Joined: Tue 04 Sep 2007, 13:23
Location: Canada

#37 Post by Caneri »

Hi All,

I hope this is the right place to ask a question about Dingo and bluetooth. (yes I know I need to read more)

Do the bluez.pets/bluetooth installer files etc work in Dingo Alpha 5.

I see in lsmod a bluetooth module has loaded by default but so far no joy...and suggestions..thanks.

Best,
Eric

EDIT: I'm trying to get my bluetooth mouse and headset working(when I get a bluetooth headset)
[color=darkred][i]Be not afraid to grow slowly, only be afraid of standing still.[/i]
Chinese Proverb[/color]

eletha
Posts: 1
Joined: Wed 06 Aug 2008, 09:37

Still having problems with BT and DBUS

#38 Post by eletha »

This is the stage I am at with my Ubuntu bluetooth config:

Code: Select all

@ubuntu1:/var/run/dbus$ sudo rm -f /var/run/dbus/*
[sudo] password for  :
@ubuntu1:/var/run/dbus$ dbus-uuidgen --ensure
@ubuntu1:/var/run/dbus$ dbus-daemon --system
Failed to start message bus: Failed to bind socket "/var/run/dbus/system_bus_socket": Permission denied
@ubuntu1:/var/run/dbus$ sudo dbus-daemon --system
@ubuntu1:/var/run/dbus$ modprobe bluetooth
@ubuntu1:/var/run/dbus$ modprobe l2cap
@ubuntu1:/var/run/dbus$ modprobe rfcomm
@ubuntu1:/var/run/dbus$ modprobe hci-usb
@ubuntu1:/var/run/dbus$ hcid -n
hcid[7798]: Bluetooth HCI daemon
hcid[7798]: HCI dev 0 registered
hcid[7799]: Can't init device hci0: Permission denied (13)
hcid[7798]: HCI dev 0 already up
hcid[7798]: Device hci0 has been added
hcid[7800]: Can't set link mode on hci0: Permission denied (13)
hcid[7800]: Can't set link policy on hci0: Permission denied (13)
hcid[7798]: Starting security manager 0
hcid[7798]: Can't write inquiry mode for hci0: Operation not permitted (1)
hcid[7798]: Created local server at unix:abstract=/var/run/dbus-BVnoISlG8C,guid=8a5aabd33609a28fc1307d0048998408
hcid[7798]: Can't create server address file
input[7801]: Bluetooth Input daemon
input[7801]: Registered input manager path:/org/bluez/input
input[7801]: Failed to listen on control channel
serial[7802]: Bluetooth Serial Port daemon
serial[7802]: Registered manager path:/org/bluez/serial
network[7803]: Bluetooth Network daemon
network[7803]: Can't create bridge
network[7803]: Bind failed. Permission denied(13)
hcid[7798]: Got NameOwnerChanged signal for :1.3 which has no listeners
Can someone help me make sense of these errors and how I can explore them/ fix them?

When I normally do hcid -n, it tells me the following:

Code: Select all

Jul 28 12:32:11 ubuntu1 hcid[9176]: Bluetooth HCI daemon
Jul 28 12:32:11 ubuntu1 hcid[9176]: Could not become the primary owner of org.bluez
Jul 28 12:32:11 ubuntu1 hcid[9176]: Unable to get on D-Bus
I tried the suggestions listed above and the previous output was shown.

I am also suspecting that the hcid and DBUS session bus are not listening in on the same socket (if that makes sense).

Code: Select all

$ dbus-launch
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-KPh3xmCqvf,guid=99a32f2da779f2875fca52004899685b
DBUS_SESSION_BUS_PID=7442
But in (from /etc/dbus-1/session.conf), session dbus listens to

Code: Select all

<listen>unix:tmpdir=/tmp</listen>
While Bluetooth (from /var/run/dbus/bluetoothd_address) listens to

Code: Select all

unix:abstract=/var/run/dbus-YTFIvIHHn3,guid=7e076046a505b17fa2548b004899667e
And (from /etc/dbus-1/system.conf) the System DBUS listens in on:

Code: Select all

<listen>unix:path=/var/run/dbus/system_bus_socket</listen>
These are pretty different, but session dbus which is the one i'm probably interacting with is listening to a different directory all together... should i hardcode this to change it to /var/run/dbus?

I've also modified the system.con and session.conf to include system-local.conf that allows user="root" and all active users to own "org.bluez" but to still no avail. I can send the the system.conf and system-local.conf files if you need them, for some reason i can't attach them here...

User avatar
steevieb
Posts: 289
Joined: Sun 31 Dec 2006, 00:11
Location: Poole, Dorset. UK

#39 Post by steevieb »

@Caneri
This page is for ArchLinux but there may be some clues in there.
http://wiki.archlinux.org/index.php/Bluetooth_Mouse
Do the bluez.pets/bluetooth installer files etc work in Dingo Alpha 5.
Yes. Although I still haven't got a file from the phone. Trying Dingo Alpha5 scsi frugal boot (I have added the tcl/tk files for MUT2 if it makes any difference.)
Dotpets here http://tinyurl.com/62f375

Caneri
Posts: 1513
Joined: Tue 04 Sep 2007, 13:23
Location: Canada

#40 Post by Caneri »

Thanks steevieb,

I'll give 'er a go tomorrow.

Best,
Eric
[color=darkred][i]Be not afraid to grow slowly, only be afraid of standing still.[/i]
Chinese Proverb[/color]

Post Reply