View previous topic :: View next topic |
Author |
Message |
pd1986 Guru
Joined: 19 Feb 2012 Posts: 404 Location: Paris
|
Posted: Thu May 31, 2012 10:27 pm Post subject: how to make bluetooth work |
|
|
Hello,
Although I don't really need this for most case, I still want to know how to make bluetooth work.
I tried following this guide: http://wiki.gentoo.org/wiki/Bluetooth. and http://en.gentoo-wiki.com/wiki/Bluetooth
But I didn't succeed.
1. my bluetooth is recognized by use hcitool. and it can detect my mobile phone too. But it can't connect to my phone by "hcitool cc xxxx(address)". When I tried running l2ping to ping my phone's address, it fail to get data. See as followed:
Code: | 0 bytes from 00:22:FC:42:2C:6B id 0 time 19.92ms
0 bytes from 00:22:FC:42:2C:6B id 1 time 40.87ms
0 bytes from 00:22:FC:42:2C:6B id 2 time 29.76ms
0 bytes from 00:22:FC:42:2C:6B id 3 time 38.60ms
0 bytes from 00:22:FC:42:2C:6B id 4 time 24.65ms
Recv failed: Connection reset by peer |
2. Then I tried blueman. I can't even start blueman-applet. It said "unloadable"
So what is wrong?
Thanks |
|
Back to top |
|
|
pd1986 Guru
Joined: 19 Feb 2012 Posts: 404 Location: Paris
|
Posted: Wed Jun 06, 2012 11:54 am Post subject: |
|
|
still wait for solution. Thanks |
|
Back to top |
|
|
ultraincognito Guru
Joined: 03 Jun 2011 Posts: 346 Location: Ukraine
|
Posted: Thu Jun 07, 2012 7:54 am Post subject: Re: how to make bluetooth work |
|
|
pd1986 wrote: | But it can't connect to my phone by "hcitool cc xxxx(address)". |
Does it write next?
Code: | Can't create connection: Operation not permitted |
|
|
Back to top |
|
|
pd1986 Guru
Joined: 19 Feb 2012 Posts: 404 Location: Paris
|
Posted: Thu Jun 07, 2012 8:39 am Post subject: Re: how to make bluetooth work |
|
|
ultraincognito wrote: | pd1986 wrote: | But it can't connect to my phone by "hcitool cc xxxx(address)". |
Does it write next?
Code: | Can't create connection: Operation not permitted |
|
I am not sure. Perhaps, because I can't establish a connection with identification.
I am at work now, I'll tell you more when I am home this evening. |
|
Back to top |
|
|
Logicien Veteran
Joined: 16 Sep 2005 Posts: 1555 Location: Montréal
|
Posted: Thu Jun 07, 2012 8:43 am Post subject: |
|
|
Hi,
you have to emerge the bluez package and start the bluetooth daemon. In /var/lib/bluetooth directory you will have a subdirectory with the name of the MAC or BD address of the bluetooth device you use as you can see with the command
In that subdirectory, you have to create, if not, a file named pincodes. This file must contain one by line, the MAC address of the device you want to connect to and, separated by a space, the pincode used by this device to accept connections.
After you discover for connections the device you want to connect with, you can use severals commands tools to create an association. When the 'remote' device ask for the pincode to provide to accept the connection, you give the one you write in the pincodes file. The association should succeed.
You must have root permissions to work with bluetooth devices. Some graphicals bluetooth interfaces only have the user permissions and cannot associate with devices. They have to be start with root permissions. Maybe there's a group a user can be in that will resolv this problem. There is no bluetooth group. _________________ Paul |
|
Back to top |
|
|
pd1986 Guru
Joined: 19 Feb 2012 Posts: 404 Location: Paris
|
Posted: Thu Jun 07, 2012 8:45 am Post subject: |
|
|
Logicien wrote: | Hi,
you have to emerge the bluez package and start the bluetooth daemon. In /var/lib/bluetooth directory you will have a subdirectory with the name of the MAC or BD address of the bluetooth device you use as you can see with the command
In that subdirectory, you have to create, if not, a file named pincodes. This file must contain one by line, the MAC address of the device you want to connect to and, separated by a space, the pincode used by this device to accept connections.
After you discover for connections the device you want to connect with, you can use severals commands tools to create an association. When the 'remote' device ask for the pincode to provide to accept the connection, you give the one you write in the pincodes file. The association should succeed.
You must have root permissions to work with bluetooth devices. Some graphicals bluetooth interfaces only have the user permissions and cannot associate with devices. They have to be start with root permissions. Maybe there's a group a user can be in that will resolv this problem. There is no bluetooth group. |
Thanks very much. I will try later |
|
Back to top |
|
|
pd1986 Guru
Joined: 19 Feb 2012 Posts: 404 Location: Paris
|
Posted: Thu Jun 07, 2012 9:56 pm Post subject: Re: how to make bluetooth work |
|
|
ultraincognito wrote: | pd1986 wrote: | But it can't connect to my phone by "hcitool cc xxxx(address)". |
Does it write next?
Code: | Can't create connection: Operation not permitted |
|
I did again. when I ran hcitool cc xxx, it returned nothing. and when I ran hcitool auth xxx, it said "Not connected" |
|
Back to top |
|
|
pd1986 Guru
Joined: 19 Feb 2012 Posts: 404 Location: Paris
|
Posted: Thu Jun 07, 2012 10:08 pm Post subject: |
|
|
Logicien wrote: | Hi,
you have to emerge the bluez package and start the bluetooth daemon. In /var/lib/bluetooth directory you will have a subdirectory with the name of the MAC or BD address of the bluetooth device you use as you can see with the command
In that subdirectory, you have to create, if not, a file named pincodes. This file must contain one by line, the MAC address of the device you want to connect to and, separated by a space, the pincode used by this device to accept connections.
After you discover for connections the device you want to connect with, you can use severals commands tools to create an association. When the 'remote' device ask for the pincode to provide to accept the connection, you give the one you write in the pincodes file. The association should succeed.
You must have root permissions to work with bluetooth devices. Some graphicals bluetooth interfaces only have the user permissions and cannot associate with devices. They have to be start with root permissions. Maybe there's a group a user can be in that will resolv this problem. There is no bluetooth group. |
I finished creating file pincode. But I don't know to connect to my phone from my laptop.
Firstly, My laptop is not discoverable, so I tried to connect to my mobile from my laptop.
Then, I could see my mobile address by "hcitool scan" but I couldn't connect to it by "hcitool cc XXX" it returned nothing, when I ran "hcitool auth XXX", it said "Not connect".
During thiese steps, I didn't see my phone ask for pincode.
this time, I did all in terminal under root account. What should I do? Thanks |
|
Back to top |
|
|
pd1986 Guru
Joined: 19 Feb 2012 Posts: 404 Location: Paris
|
Posted: Thu Jun 07, 2012 10:09 pm Post subject: |
|
|
In addition, I don't have plugdev group, does it matter? |
|
Back to top |
|
|
pd1986 Guru
Joined: 19 Feb 2012 Posts: 404 Location: Paris
|
Posted: Thu Jun 07, 2012 10:18 pm Post subject: |
|
|
This time, I ran
Quote: | hcitool cc xxx && hcitool auth xxx |
I get "HCI authentication request failed: Input/output error".
Then I ran again "hcitool auth xxx", it returned "Not connected" |
|
Back to top |
|
|
Logicien Veteran
Joined: 16 Sep 2005 Posts: 1555 Location: Montréal
|
Posted: Thu Jun 07, 2012 10:35 pm Post subject: |
|
|
First do you have root access? Without it everything can fail. Open a root session for test and when it work, you can try to do it with a user account. In root session, I do not think you need to be in plugdev group to configure Bluetooth or anything else.
Most of the times, I connect devices via Bluetooth for precise perposes, like using obexftp or obexfs. In my /etc/fstab I have this line:
Code: | obexfs#-bxx:xx:xx:xx:xx:xx /mnt/cell fuse allow_other,noatime,noauto,rw,sync,users 0 0 |
Change xx:xx:xx:xx:xx:xx for the Bluetooth hardware address of your cellular, create the directory /mnt/cell, install the obexfs and fuse packages and put your cellular in discovery mode. Then
should ask your cellular for the pincode write in the pincodes file and give you access to it's data in /mnt/cell. Remember to tell your cellular to always accept connections from your Gentoo host. Then your cellular will not ask for a pincode anymore for this host. Automatics connections will be made without put you cellular in discovery mode. _________________ Paul |
|
Back to top |
|
|
pd1986 Guru
Joined: 19 Feb 2012 Posts: 404 Location: Paris
|
Posted: Thu Jun 07, 2012 10:48 pm Post subject: |
|
|
Logicien wrote: | First do you have root access? Without it everything can fail. Open a root session for test and when it work, you can try to do it with a user account. In root session, I do not think you need to be in plugdev group to configure Blutooth or anything else.
Most of the times, I connect devices via Bluetooth for precise perposes, like using obexftp or obexfs. In my /etc/fstab I have this line:
Code: | obexfs#-bxx:xx:xx:xx:xx:xx /mnt/cell fuse allow_other,noatime,noauto,rw,sync,users 0 0 |
Change xx:xx:xx:xx:xx:xx for the Bluetooth hardware address of your cellular, create the directory /mnt/cell, install the obexfs and fuse packages and put your cellular in discovery mode. Then
should ask your cellular for the pincode write in the pincodes file and give you access to it's data in /mnt/cell. Remember to tell your cellular to always accept connections from your Gentoo host. |
yes, I did that all in root account:
Before doing what you proposed, I start thinking if my kernel configuration is too simple.
Given that the bluetooth guide is a little old, (http://www.gentoo.org/doc/en/bluetooth-guide.xml, last updated in july 2009), I followed the guide in gentoo wiki.(http://wiki.gentoo.org/wiki/Bluetooth). As it says, I just add one module " <M> HCI USB driver".
Is it too simple? Do I need more modules?
Thanks |
|
Back to top |
|
|
Logicien Veteran
Joined: 16 Sep 2005 Posts: 1555 Location: Montréal
|
Posted: Fri Jun 08, 2012 1:35 am Post subject: |
|
|
If the commands hciconfig -a return the details of hci0 and hcitool -i hci0 scan give your cellular name and hardware address, that's mean your kernel configuration support Bluetooth devices. Other stuff may be missing, I don't have any idea for the moment. _________________ Paul |
|
Back to top |
|
|
ultraincognito Guru
Joined: 03 Jun 2011 Posts: 346 Location: Ukraine
|
Posted: Fri Jun 08, 2012 6:09 am Post subject: |
|
|
pd1986 wrote: | Is it too simple? |
It's enough simple.
pd1986 wrote: | Do I need more modules? |
You need switch on "L2CAP protocol support" and "RFCOMM protocol support". But if you can press "hcitool scan" to see a list of active bluetooth devices, then your kernel is fine, I guess.
And I agree with Logicien. Obexfs is very pretty thing, but I use the simple-agent for enter a pin. It's easier then put a pin to some files because the simple-agent only is need to run in an another terminal, just enter the pin and press Enter. |
|
Back to top |
|
|
pd1986 Guru
Joined: 19 Feb 2012 Posts: 404 Location: Paris
|
Posted: Fri Jun 08, 2012 7:29 am Post subject: |
|
|
Logicien wrote: | If the commands hciconfig -a return the details of hci0 and hcitool -i hci0 scan give your cellular name and hardware address, that's mean your kernel configuration support Bluetooth devices. Other stuff may be missing, I don't have any idea for the moment. |
I ran hciconfig -a, it returned
Code: | hci0: Type: BR/EDR Bus: USB
BD Address: 00:22:58:FA:90:95 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING PSCAN
RX bytes:2409 acl:0 sco:0 events:65 errors:0
TX bytes:753 acl:0 sco:0 commands:64 errors:0
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x59 0x83
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'Gentoo-0'
Class: 0x000100
Service Classes: Unspecified
Device Class: Computer, Uncategorized
HCI Version: 2.1 (0x4) Revision: 0x13ee
LMP Version: 2.1 (0x4) Subversion: 0x13ee
Manufacturer: Cambridge Silicon Radio (10)
|
then I ran hcitool -i hci0, it just showed the hcitool command description. |
|
Back to top |
|
|
pd1986 Guru
Joined: 19 Feb 2012 Posts: 404 Location: Paris
|
Posted: Fri Jun 08, 2012 7:33 am Post subject: |
|
|
ultraincognito wrote: | pd1986 wrote: | Is it too simple? |
It's enough simple.
pd1986 wrote: | Do I need more modules? |
You need switch on "L2CAP protocol support" and "RFCOMM protocol support". But if you can press "hcitool scan" to see a list of active bluetooth devices, then your kernel is fine, I guess.
And I agree with Logicien. Obexfs is very pretty thing, but I use the simple-agent for enter a pin. It's easier then put a pin to some files because the simple-agent only is need to run in an another terminal, just enter the pin and press Enter. |
Yeah, but now that hcitool doesn't work, I doubt if obexfs could work. so I prefer figuring out why hcitool doesn't work then I will try others. Please glance at my reply to Logicien. There are some information. See if you can find something please. Thanks. |
|
Back to top |
|
|
Logicien Veteran
Joined: 16 Sep 2005 Posts: 1555 Location: Montréal
|
Posted: Fri Jun 08, 2012 8:10 am Post subject: |
|
|
ultraincognito told you some extra features you can have with bluetooth devices, like DUN (DialUp Networking), support for HID devices, Bluetooth networking, etc. You can see what feature a device support with the command
Code: | hcitool -i hci0 info <bdaddr> |
where <bdaddr> is the hardware address of a bluetooth device. That's gone tell you what can be activate for practicle use with Bluetooth in your kernel configuration.
If you don't append a command to hcitool, you will get the help message, because there is nothing else hcitool can do. So if you want to scan devices do
Code: | hcitool -i hci0 scan |
_________________ Paul |
|
Back to top |
|
|
pd1986 Guru
Joined: 19 Feb 2012 Posts: 404 Location: Paris
|
Posted: Fri Jun 08, 2012 4:51 pm Post subject: |
|
|
Logicien wrote: | ultraincognito told you some extra features you can have with bluetooth devices, like DUN (DialUp Networking), support for HID devices, Bluetooth networking, etc. You can see what feature a device support with the command
Code: | hcitool -i hci0 info <bdaddr> |
where <bdaddr> is the hardware address of a bluetooth device. That's gone tell you what can be activate for practicle use with Bluetooth in your kernel configuration.
If you don't append a command to hcitool, you will get the help message, because there is nothing else hcitool can do. So if you want to scan devices do
Code: | hcitool -i hci0 scan |
|
this is the output of hcitool -i hci0 info 00:22:FC:42:2C:6B
Code: | Requesting information ...
BD Address: 00:22:FC:42:2C:6B
OUI Company: Nokia Danmark A/S (00-22-FC)
Device Name: Pd
LMP Version: 2.0 (0x3) LMP Subversion: 0x2222
Manufacturer: Broadcom Corporation (15)
Features: 0xbf 0xee 0x0f 0xce 0x98 0x39 0x00 0x00
<3-slot packets> <5-slot packets> <encryption> <slot offset>
<timing accuracy> <role switch> <sniff mode> <RSSI>
<channel quality> <SCO link> <HV3 packets> <u-law log>
<A-law log> <CVSD> <paging scheme> <power control>
<transparent SCO> <EDR ACL 2 Mbps> <EDR ACL 3 Mbps>
<enhanced iscan> <inquiry with RSSI> <extended SCO>
<AFH cap. slave> <AFH class. slave> <3-slot EDR ACL>
<5-slot EDR ACL> <AFH cap. master> <AFH class. master>
<EDR eSCO 2 Mbps>
|
I can see it, I can find the information. I just can't connect my laptop to it. |
|
Back to top |
|
|
jesterchen n00b
Joined: 21 Jan 2012 Posts: 33
|
Posted: Mon Feb 04, 2013 8:56 am Post subject: |
|
|
Old topic, but perhaps still of help:
To solve the HCI-Auth-input-output-thing I did the following steps:
Start `simple-agent` (part of net-wireless/bluez) as root.
In another terminal start `hcitool cc 00:13:70:D1:XX:XX && hcitool auth 00:13:70:D1:XX:XX`.
In the first window I was immediately asked for the pin and now everything works like a charm. |
|
Back to top |
|
|
|