https://wiki.archlinux.org/api.php?action=feedcontributions&user=Leeyee&feedformat=atomArchWiki - User contributions [en]2024-03-29T05:11:42ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Bluetooth_GPRS_Howto&diff=66259Bluetooth GPRS Howto2009-04-05T03:36:15Z<p>Leeyee: </p>
<hr />
<div>[[Category:Other hardware (English)]]<br />
<br />
This Howto will describe, how to set up a GPRS Internet connection using bluetooth device and compatible mobile phone.<br />
<br />
==Requirements==<br />
# Linux compatible bluetooth device<br />
# Bluetooth enabled mobile phone - I'm using Nokia N70<br />
<br />
==Instructions==<br />
<ol><br />
<li>Install bluez-utils, bluez-libs and dbus (install also ppp if you haven't): <pre>pacman -S bluez-utils bluez-libs dbus</pre></li><br />
<li>Start dbus and bluetooth service: <pre>/etc/rc.d/dbus start<br />
/etc/rc.d/bluetooth start</pre></li><br />
<li>Scan for nearby bluetooth devices: <pre>hcitool scan<br />
Scanning ...<br />
00:19:79:89:13:8E Penpen N70</pre><br />
Now, mark that above address, it's the bluetooth hardware address of your mobile phone (provided that the name in the right matches what you have written in the phone).</li><br />
<li>Scan, which channel is used for Dial-Up Networking: <pre>sdptool search --bdaddr 00:19:79:89:13:8E DUN<br />
Inquiring ...<br />
Searching for DUN on 00:19:79:89:13:8E ...<br />
Service Name: Dial-Up Networking<br />
Service RecHandle: 0x10007<br />
Service Class ID List:<br />
"Dialup Networking" (0x1103)<br />
Protocol Descriptor List:<br />
"L2CAP" (0x0100)<br />
"RFCOMM" (0x0003)<br />
Channel: 3<br />
Language Base Attr List:<br />
code_ISO639: 0x454e<br />
encoding: 0x6a<br />
base_offset: 0x100<br />
Profile Descriptor List:<br />
"Dialup Networking" (0x1103)<br />
Version: 0x0100<br />
</pre>Now check the line beginning with "Channel:" - it contains the channel which is used for Dial-Up Network and it is <strong>not necessarily</strong> 1 and so is the case with my Nokia N70; my phone uses channel 3. Check also that you are reading the right results; the bluetooth hardware address must match your phone's.</li><br />
<li>Next, edit /etc/bluetooth/hcid.conf . Set the following in options section: <pre>autoinit yes;<br />
security auto;</pre> Editing the same file, comment out passkey, as it is not used actually. Also, in the device section change<br />
the line beginning with name to: <pre>name "BlueZ (%h)";</pre></li><br />
<li>Now edit /etc/bluetooth/rfcomm.conf , first uncomment the rfcomm0 device section. Then add/change the lines as this (if necessary): <pre>bind yes;<br />
device 00:19:79:89:13:8E;<br />
channel 3;<br />
comment "GPRS dialup";</pre>Of course, you should use your device address and the appropriate channel.</li><br />
<li>Edit the bluetooth script in /etc/rc.d/bluetooth to make the rfcomm start when bluetooth system is started: <pre>RFCOMM_ENABLE="true"</pre></li><br />
<li>Restart the bluetooth service: <pre>/etc/rc.d/bluetooth restart</pre></li><br />
<li>Look, whether the bluetooth device is bound to the phone. It should look like this: <pre>ll /dev/rfcomm0<br />
crw-rw---- 1 root tty 216, 0 2007-08-10 21:32 /dev/rfcomm0</pre></li><br />
<li>Now comes the interesting part. You see, there must be an agreed password for connecting to the phone's modem. And this password is set up in an awkward way. First decide a password. Then open another root console, type there (substitute your phone's hardware address and password accordingly) <pre>passkey-agent 8922 00:19:79:89:13:8E</pre> , but don't press enter yet. On another root window, issue<br />
<pre>cat /dev/rfcomm0</pre> and immediately after that execute the typed passkey-agent command in other window. Situation is like this http://asuka.fi/u/jpaalija/tmp/catting_passkey-agent_ready.png The phone should now show something like this: http://asuka.fi/u/jpaalija/tmp/passcode_dialog.jpg . Quickly, enter the passcode and press "Ok". If the passkey-agent prints something like <pre>Passkey request for device 00:19:79:89:13:8E<br />
Passkey service has been released</pre> you have no need to hurry anymore as you are almost set.<br />
Next, go to Menu->Connectivity->Bluetooth, select right for paired devices, select Options->Set as authorized, confirm and you are done!</li><br />
<li>Edit the bottom of /etc/ppp/ip-up as following: <pre>echo -e "#generated by ip-up\nsearch local\nnameserver $DNS1\nnameserver $DNS2" > /etc/resolv.conf<br />
chmod a+r /etc/resolv.conf</pre>This change is used to set correct DNS settings after connection.</li><br />
<li>Now you need scripts to actually use the phone's modem and call your ISP. My ISP is the Finnish saunalahti, mainly because of it's predefined fee for unlimited data access. You must substitute saunalahti for your ISP accordingly through the rest of the document. First we edit the modem setup script for my isp. I'm using script named /etc/ppp/peers/saunalahti and having the following content: <pre>show-password <br />
noauth<br />
/dev/rfcomm0<br />
115200<br />
connect /etc/ppp/peers/saunalahti-connect<br />
disconnect /etc/ppp/peers/saunalahti-disconnect<br />
defaultroute<br />
#replacedefaultroute<br />
noipdefault <br />
#nodetach<br />
usepeerdns<br />
crtscts<br />
local<br />
ipcp-accept-local<br />
#lcp-echo-interval 0<br />
maxfail 10<br />
lcp-echo-failure 0<br />
lcp-echo-interval 0<br />
#lcp-max-configure 0<br />
#lcp-max-failure 10000<br />
#lcp-max-terminate 0<br />
#lcp-restart 30000 <br />
novj<br />
nobsdcomp<br />
novjccomp<br />
nopcomp<br />
noaccomp<br />
linkname saunalahti<br />
mtu 1500<br />
mru 1500</pre> Some remarks: You should possibly first uncomment the nodetach-option, so you can track, whether the call succeeds. Without the option you just get no confirmation. <br />
Some Carrier needs special username and password for connection. In this case you should add:<br />
<pre><br />
user "username"<br />
password "passwd"<br />
</pre><br />
A good list of Carrier's and ther username/password pairs can be found here: http://wiki.openmoko.org/wiki/GPRS<br />
<br />
The lines starting with "connect" and "disconnect" are locations for connect and disconnect chat scripts. Chat scripts are used to "talk" with the modem. Lets take a look at them next. </li><br />
<li>Now, we edit the connect script. Mine is at /etc/ppp/peers/saunalahti-connect and is like the following: <pre>#!/bin/sh<br />
exec chat \<br />
TIMEOUT 5 \<br />
ECHO ON \<br />
ABORT '\nBUSY\r' \<br />
ABORT '\nERROR\r' \<br />
ABORT '\nNO ANSWER\r' \<br />
ABORT '\nNO CARRIER\r' \<br />
ABORT '\nNO DIALTONE\r' \<br />
ABORT '\nRINGING\r\n\r\nRINGING\r' \<br />
'' \rAT \<br />
TIMEOUT 12 \<br />
SAY "Press CTRL-C to close the connection at any stage!" \<br />
SAY "\ndefining PDP context...\n" \<br />
OK ATH \<br />
OK ATE1 \<br />
OK 'AT+CGDCONT=1,"IP","internet.saunalahti","",0,0' \<br />
OK ATD*99# \<br />
TIMEOUT 22 \<br />
SAY "\nwaiting for connect...\n" \<br />
CONNECT "" \<br />
SAY "\nConnected." \<br />
SAY "\nIf the following ppp negotiations fail,\n" \<br />
SAY "try restarting the phone.\n"</pre>Also some remarks about these: In the place of internet.saunalahti you should have your mobile operators access point name. That can be checked from Settings->Connection->Access points . Hilight the Internet access point and select edit. Go down to section "Access point name". There you have it. One more thing. The modem command "ATD*99#"'s number "*99#" is a special number (at least in Nokia phones) which is used to "call to Internet access point". Pretty clever I'd say; no fiddling around with actual numbers, let the phone handle everything behind the scenes.</li><br />
<li>Edit the disconnect script (mine's is in /etc/ppp/peers/saunalahti-disconnect). You should have something like this: <pre>#!/bin/sh<br />
exec /usr/sbin/chat -V -s -S \<br />
ABORT "BUSY" \<br />
ABORT "ERROR" \<br />
ABORT "NO DIALTONE" \<br />
SAY "\nSending break to the modem\n" \<br />
"" "\K" \<br />
"" "\K" \<br />
"" "\K" \<br />
"" "+++ATH" \<br />
"" "+++ATH" \<br />
"" "+++ATH" \<br />
SAY "\nPDP context detached\n"</pre></li><br />
<li>Set executable atribute for files saunalahti-connect and saunalahti-disconnect<pre>chmod +x /etc/ppp/peers/saunalahti*connect</pre></li><br />
<li>Ok, you have completely set up bluetooth + gprs connection. Yay! Next thing to do is to test it. If you let the "nodetach" option uncommented in section 12, running (again, substitute yourisp for, well your ISP :) <pre>pon yourisp</pre> should return something like this: <pre>Press CTRL-C to close the connection at any stage!<br />
defining PDP context...<br />
rAT<br />
OK<br />
ATH<br />
OK<br />
ATE1<br />
OK<br />
AT+CGDCONT=1,"IP","internet.saunalahti","",0,0<br />
OK<br />
waiting for connect...<br />
<br />
ATD*99#<br />
CONNECT<br />
Connected.<br />
If the following ppp negotiations fail,<br />
try restarting the phone.<br />
<br />
Serial connection established.<br />
Using interface ppp0<br />
Connect: ppp0 <--> /dev/rfcomm0<br />
kernel does not support PPP filtering<br />
Cannot determine ethernet address for proxy ARP<br />
local IP address 85.77.231.188<br />
remote IP address 10.6.6.6<br />
primary DNS address 195.197.54.100<br />
secondary DNS address 195.74.0.47</pre> If the output is something similar, you have a working connection . If this is the case, you can press ctrl-c to abort the connection and uncomment the "nodetach" option from section 12. Later when you want connection, you can just run <pre>pon yourisp</pre> and when disconnecting <pre>poff yourisp</pre>.<br />
<li>Add "dbus bluetooth" to the DAEMONS section in /etc/rc.conf so you can connect more easily after reboot.</li><br />
<li>All done, enjoy!</li><br />
</ol><br />
<br />
==Use Blueman and NetworkManager==<br />
Up to blueman 1.02-1 and networkmanager 0.70-1, there is no need to edit any configuration files anymore, so that we can easily set up bluetooth GRPS dialup purely in GUI. Tested with Nokia N70.<br />
<br />
1, Click bluetooth applet and right click in blank area to select "Setup", then Bluetooth Manager will automatically search and setup devices for you, and you can choose to "connect to DialUp networking" if your device support this. After this, check out if you've got /dev/rfcomm0, if so you've got paired.<br />
<br />
2, Right click on nm-applet and choose "Edit Connections", choose Mobile Broadband tab, click "add" it will pop you up to choose a Mobile Broadband Connection, there you can see your bluetooth device.<br />
<br />
3, Edit properties of the connection, remember to change up to your own network setting. Normally, you only need to provide number and APN, leave others blank. And uncheck "Use authentication" in PPP tab, otherwise dialup would fail.<br />
<br />
4, Select and connect to dialup service just like other connection type with networkmanager.</div>Leeyeehttps://wiki.archlinux.org/index.php?title=Bluetooth&diff=59277Bluetooth2009-01-26T07:22:10Z<p>Leeyee: /* Using Obex for sending and receiving files */</p>
<hr />
<div>{{stub}}<br />
[[Category:Communication and network (English)]]<br />
[[Category:HOWTOs (English)]]<br />
<br />
== Introduction ==<br />
This article is about setting up and using [[wikipedia:Bluetooth|Bluetooth]] with an USB Bluetooth dongle on Arch Linux.<br />
<br />
== Installation ==<br />
First you have to install the [http://bluez.org bluez-utils] utilities for the Linux Bluetooth protocol stack and start all needed daemons.<br />
# pacman -S bluez-utils<br />
<br />
It seems like dbus must be running for certain settings to be read. It is also needed (afaik) for pin pairing. It is important that dbus is started *before* bluetooth.<br />
# /etc/rc.d/dbus start<br />
<br />
# /etc/rc.d/bluetooth start<br />
<br />
<br />
After that you should check if your Bluetooth dongle is recognized. You can do that by inspecting <tt>/var/log/messages.log</tt> when plugging in the USB dongle. It should look something like the following (look out for hci):<br />
<br />
# tail -f /var/log/messages.log<br />
May 2 23:36:40 tatooine usb 4-1: new full speed USB device using uhci_hcd and address 9<br />
May 2 23:36:40 tatooine usb 4-1: configuration #1 chosen from 1 choice<br />
May 2 23:36:41 tatooine hcid[8109]: HCI dev 0 registered<br />
May 2 23:36:41 tatooine hcid[8109]: HCI dev 0 up<br />
May 2 23:36:41 tatooine hcid[8109]: Device hci0 has been added<br />
May 2 23:36:41 tatooine hcid[8109]: Starting security manager 0<br />
May 2 23:36:41 tatooine hcid[8109]: Device hci0 has been activated<br />
<br />
For a list of supported hardware please refer to the [[Bluetooth#Resources|resources]] section on this page.<br />
<br />
To verify that the device was detected you can use <tt>hcitool</tt> which is part of the <tt>bluez-utils</tt>. You can get a list of available devices and their identifiers and their MAC address by issuing:<br />
<br />
$ hcitool dev<br />
Devices:<br />
hci0 00:1B:DC:0F:DB:40<br />
<br />
More detailed informations about the device can be retrieved by using <tt>hciconfig</tt>.<br />
<br />
$ hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:1B:DC:0F:DB:40 ACL MTU: 310:10 SCO MTU: 64:8<br />
UP RUNNING PSCAN ISCAN <br />
RX bytes:1226 acl:0 sco:0 events:27 errors:0<br />
TX bytes:351 acl:0 sco:0 commands:26 errors:0<br />
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 <br />
Link policy: RSWITCH HOLD SNIFF PARK <br />
Link mode: SLAVE ACCEPT <br />
Name: 'BlueZ (0)'<br />
Class: 0x000100<br />
Service Classes: Unspecified<br />
Device Class: Computer, Uncategorized<br />
HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c<br />
Manufacturer: Cambridge Silicon Radio (10)<br />
<br />
== Configuration ==<br />
The <tt>bluez-utils</tt> configuration files are located in <tt>/etc/bluetooth</tt>.<br />
$ ls -1 /etc/bluetooth<br />
audio.conf<br />
hcid.conf<br />
network.conf<br />
rfcomm.conf<br />
<br />
The default configuration file of the <tt>hcid</tt> daemon should fit most purposes. However, you probably have to change the <tt>passkey</tt> option to the one of your phone (most mobile phones use either 1234 or 0000).<br />
<br />
# HCId options<br />
options {<br />
<br />
...<br />
<br />
# Default PIN code for incoming connections<br />
passkey "0000";<br />
}<br />
<br />
For some mobile phones you maybe also have to change the device class in the device section (I haven't found a comprehensive list of device classes yet, in my case the default setting worked).<br />
<br />
# Default settings for HCI devices<br />
device {<br />
<br />
...<br />
<br />
# Local device class<br />
class 0x000100;<br />
<br />
...<br />
}<br />
<br />
== Pairing ==<br />
'''''Disclaimer:''' This section might not be completely accurate.''<br />
<br />
Many bluetooth devices require pairing. ([http://en.wikipedia.org/wiki/Bluetooth#Pairing Wikipedia entry])<br />
The exact procedure depends among other on the devices involved, and their input functionality.<br />
The procedure on Siemens S55 is as follows:<br />
* The computer sends a connect request to S55. <br />
* A pin, determined by the computer, is prompted for at S55<br />
* The same key must be re-entered at the computer.<br />
<br />
The pin used is specified in <tt>/etc/bluetooth/hcid.conf</tt> (I think?). (passkey under options)<br />
When the computer needs to supply the pin the second time, bluez uses dbus to fetch the key. A simple daemon/dbus-agent is provided in the <tt>bluez-utils</tt> package.<br />
<br />
$> passkey-agent --default PIN<br />
<tt>PIN</tt> will be used for all devices. A bluetooth address can be supplied to restrict this.<br />
<br />
The pairing procedure seems to start whenever you try to access the phone/device.<br />
<br />
To scan for external devices, do<br />
$> hcitool scan<br />
<!--<br />
== Applications ==<br />
=== Remote Control The Desktop With A Mobile Phone ===<br />
Lost?<br />
--><br />
<br />
== Troubleshooting ==<br />
=== passkey-agent ===<br />
$> passkey-agent --default 1234<br />
Can't register passkey agent<br />
The name org.bluez was not provided by any .service files<br />
You probably started <tt>/etc/rc.d/bluetooth</tt> before <tt>/etc/rc.d/dbus</tt><br />
$> hciconfig dev<br />
# (no listing)<br />
Try running <tt>hciconfig hc0 up</tt><br />
<br />
=== bluez-gnome ===<br />
If you see this when trying to enable receiving files in bluetooth-properties:<br />
Bluetooth OBEX start failed: Invalid path<br />
Bluetooth FTP start failed: Invalid path<br />
Then run:<br />
# pacman -S xdg-user-dirs<br />
$ xdg-user-dirs-update<br />
You can edit the paths using:<br />
$ vi ~/.config/user-dirs.dirs<br />
<br />
== Examples ==<br />
=== Siemens S55 ===<br />
This is what I did to connect to my S55. (I have not figured out how to initiate the connection from the phone)<br />
* The steps under installation<br />
* <br />
$> hcitool scan<br />
Scanning ...<br />
XX:XX:XX:XX:XX:XX NAME<br />
$> B=XX:XX:XX:XX:XX:XX<br />
$> passkey-agent --default 1234 $B &<br />
[1] 5386<br />
$> obexftp -b $B -l "Address book"<br />
# Phone ask for pin, I enter it and answer yes when asked if I want to save the device<br />
...<br />
<file name="5F07.adr" size="78712" modified="20030101T001858" user-perm="WD" group-perm="" /><br />
...<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -g "Address book/5F07.adr"<br />
Browsing 00:01:E3:6B:FF:D7 ...<br />
Channel: 5<br />
Connecting...done<br />
Receiving "Address book/5F07.adr"... Sending "Address book"... done<br />
Disconnecting...done<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -p a <br />
...<br />
Sending "a"... done<br />
Disconnecting...done<br />
<br />
=== Logitech Mouse MX Laser===<br />
Connect Bluetooth Logitech Mouse MX Laser without Dongle.<br />
$> hidd --connect XX:XX:XX:XX:XX:XX<br />
<br />
== Using Obex for sending and receiving files ==<br />
<br />
=== Using GNOME tools ===<br />
I am using a Palm Treo 650 and have successfully been able to send files both ways between the phone and my Arch box. Pairing the device as instructed above, I checked that I had installed the following<br />
# pacman -S gnome-bluetooth bluez-gnome bluez-libs bluez-utils<br />
<br />
I used this link to add a Bluetooth entry to the SendTo menu in thunar's file properties menu: http://thunar.xfce.org/pwiki/documentation/sendto_menu<br />
<br />
I then ran<br />
$ gnome-obex-server<br />
<br />
A blue tray icon will appear. Now I am able to right-click any file in thunar, go to the SendTo menu and hit "Bluetooth OBEX Recipient." I then choose the device and send the file. Likewise, using the send via bluetooth option on my Palm I am able to send a file to the Arch box, where I see a receive dialog appear and can choose to accept it or not.<br />
<br />
In some cases, if you're told "send failure" when trying to receive file from mobile phone, you may need to open "Applications->System Tools->Bluetooth File Sharing".<br />
<br />
I can't guarantee this working for every phone or combination, but I also tried it with a Nokia E65 and was successful. -[mailto:brownitus@gmail.com colbert]<br />
<br />
=== Browse Device ===<br />
TODO<br />
<br />
At present, "Browse Device" function of bluetooth tray icon(bluez-gnome) doesn't work, It only shows a blank nautilus window. It is said that gnome-vfs-obexftp package in AUR may work, but I cannot figure it out for now.<br />
<br />
=== Using Obexfs ===<br />
Another option rather than using KDE or Gnome Bluetooth packages is Obexfs which allows you to mount your phone and treat it as part of your filesystem. Note that to use Obexfs, you need a device that provides an Obex FTP service.<br />
<br />
To install;<br />
# pacman -S obexfs<br />
<br />
and then your phone can then be mounted running as root <br />
# obexfs -b <devices mac address> /mountpoint<br />
<br />
For more mounting options see http://dev.zuckschwerdt.org/openobex/wiki/ObexFs<br />
<br />
== Resources ==<br />
*[http://www.bluez.org Official Linux Bluetooth protocol stack]<br />
*[http://www.holtmann.org/linux/bluetooth/devices.html List of Linux supported Bluetooth Hardware]<br />
*[http://www.gentoo.org/doc/en/bluetooth-guide.xml Gentoo wiki is usually good]<br />
*[http://linuxgazette.net/109/oregan3.html Accessing a Bluetooth phone on Linux Gazette]</div>Leeyeehttps://wiki.archlinux.org/index.php?title=Bluetooth&diff=59276Bluetooth2009-01-26T07:16:40Z<p>Leeyee: /* Using GNOME tools */</p>
<hr />
<div>{{stub}}<br />
[[Category:Communication and network (English)]]<br />
[[Category:HOWTOs (English)]]<br />
<br />
== Introduction ==<br />
This article is about setting up and using [[wikipedia:Bluetooth|Bluetooth]] with an USB Bluetooth dongle on Arch Linux.<br />
<br />
== Installation ==<br />
First you have to install the [http://bluez.org bluez-utils] utilities for the Linux Bluetooth protocol stack and start all needed daemons.<br />
# pacman -S bluez-utils<br />
<br />
It seems like dbus must be running for certain settings to be read. It is also needed (afaik) for pin pairing. It is important that dbus is started *before* bluetooth.<br />
# /etc/rc.d/dbus start<br />
<br />
# /etc/rc.d/bluetooth start<br />
<br />
<br />
After that you should check if your Bluetooth dongle is recognized. You can do that by inspecting <tt>/var/log/messages.log</tt> when plugging in the USB dongle. It should look something like the following (look out for hci):<br />
<br />
# tail -f /var/log/messages.log<br />
May 2 23:36:40 tatooine usb 4-1: new full speed USB device using uhci_hcd and address 9<br />
May 2 23:36:40 tatooine usb 4-1: configuration #1 chosen from 1 choice<br />
May 2 23:36:41 tatooine hcid[8109]: HCI dev 0 registered<br />
May 2 23:36:41 tatooine hcid[8109]: HCI dev 0 up<br />
May 2 23:36:41 tatooine hcid[8109]: Device hci0 has been added<br />
May 2 23:36:41 tatooine hcid[8109]: Starting security manager 0<br />
May 2 23:36:41 tatooine hcid[8109]: Device hci0 has been activated<br />
<br />
For a list of supported hardware please refer to the [[Bluetooth#Resources|resources]] section on this page.<br />
<br />
To verify that the device was detected you can use <tt>hcitool</tt> which is part of the <tt>bluez-utils</tt>. You can get a list of available devices and their identifiers and their MAC address by issuing:<br />
<br />
$ hcitool dev<br />
Devices:<br />
hci0 00:1B:DC:0F:DB:40<br />
<br />
More detailed informations about the device can be retrieved by using <tt>hciconfig</tt>.<br />
<br />
$ hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:1B:DC:0F:DB:40 ACL MTU: 310:10 SCO MTU: 64:8<br />
UP RUNNING PSCAN ISCAN <br />
RX bytes:1226 acl:0 sco:0 events:27 errors:0<br />
TX bytes:351 acl:0 sco:0 commands:26 errors:0<br />
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 <br />
Link policy: RSWITCH HOLD SNIFF PARK <br />
Link mode: SLAVE ACCEPT <br />
Name: 'BlueZ (0)'<br />
Class: 0x000100<br />
Service Classes: Unspecified<br />
Device Class: Computer, Uncategorized<br />
HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c<br />
Manufacturer: Cambridge Silicon Radio (10)<br />
<br />
== Configuration ==<br />
The <tt>bluez-utils</tt> configuration files are located in <tt>/etc/bluetooth</tt>.<br />
$ ls -1 /etc/bluetooth<br />
audio.conf<br />
hcid.conf<br />
network.conf<br />
rfcomm.conf<br />
<br />
The default configuration file of the <tt>hcid</tt> daemon should fit most purposes. However, you probably have to change the <tt>passkey</tt> option to the one of your phone (most mobile phones use either 1234 or 0000).<br />
<br />
# HCId options<br />
options {<br />
<br />
...<br />
<br />
# Default PIN code for incoming connections<br />
passkey "0000";<br />
}<br />
<br />
For some mobile phones you maybe also have to change the device class in the device section (I haven't found a comprehensive list of device classes yet, in my case the default setting worked).<br />
<br />
# Default settings for HCI devices<br />
device {<br />
<br />
...<br />
<br />
# Local device class<br />
class 0x000100;<br />
<br />
...<br />
}<br />
<br />
== Pairing ==<br />
'''''Disclaimer:''' This section might not be completely accurate.''<br />
<br />
Many bluetooth devices require pairing. ([http://en.wikipedia.org/wiki/Bluetooth#Pairing Wikipedia entry])<br />
The exact procedure depends among other on the devices involved, and their input functionality.<br />
The procedure on Siemens S55 is as follows:<br />
* The computer sends a connect request to S55. <br />
* A pin, determined by the computer, is prompted for at S55<br />
* The same key must be re-entered at the computer.<br />
<br />
The pin used is specified in <tt>/etc/bluetooth/hcid.conf</tt> (I think?). (passkey under options)<br />
When the computer needs to supply the pin the second time, bluez uses dbus to fetch the key. A simple daemon/dbus-agent is provided in the <tt>bluez-utils</tt> package.<br />
<br />
$> passkey-agent --default PIN<br />
<tt>PIN</tt> will be used for all devices. A bluetooth address can be supplied to restrict this.<br />
<br />
The pairing procedure seems to start whenever you try to access the phone/device.<br />
<br />
To scan for external devices, do<br />
$> hcitool scan<br />
<!--<br />
== Applications ==<br />
=== Remote Control The Desktop With A Mobile Phone ===<br />
Lost?<br />
--><br />
<br />
== Troubleshooting ==<br />
=== passkey-agent ===<br />
$> passkey-agent --default 1234<br />
Can't register passkey agent<br />
The name org.bluez was not provided by any .service files<br />
You probably started <tt>/etc/rc.d/bluetooth</tt> before <tt>/etc/rc.d/dbus</tt><br />
$> hciconfig dev<br />
# (no listing)<br />
Try running <tt>hciconfig hc0 up</tt><br />
<br />
=== bluez-gnome ===<br />
If you see this when trying to enable receiving files in bluetooth-properties:<br />
Bluetooth OBEX start failed: Invalid path<br />
Bluetooth FTP start failed: Invalid path<br />
Then run:<br />
# pacman -S xdg-user-dirs<br />
$ xdg-user-dirs-update<br />
You can edit the paths using:<br />
$ vi ~/.config/user-dirs.dirs<br />
<br />
== Examples ==<br />
=== Siemens S55 ===<br />
This is what I did to connect to my S55. (I have not figured out how to initiate the connection from the phone)<br />
* The steps under installation<br />
* <br />
$> hcitool scan<br />
Scanning ...<br />
XX:XX:XX:XX:XX:XX NAME<br />
$> B=XX:XX:XX:XX:XX:XX<br />
$> passkey-agent --default 1234 $B &<br />
[1] 5386<br />
$> obexftp -b $B -l "Address book"<br />
# Phone ask for pin, I enter it and answer yes when asked if I want to save the device<br />
...<br />
<file name="5F07.adr" size="78712" modified="20030101T001858" user-perm="WD" group-perm="" /><br />
...<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -g "Address book/5F07.adr"<br />
Browsing 00:01:E3:6B:FF:D7 ...<br />
Channel: 5<br />
Connecting...done<br />
Receiving "Address book/5F07.adr"... Sending "Address book"... done<br />
Disconnecting...done<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -p a <br />
...<br />
Sending "a"... done<br />
Disconnecting...done<br />
<br />
=== Logitech Mouse MX Laser===<br />
Connect Bluetooth Logitech Mouse MX Laser without Dongle.<br />
$> hidd --connect XX:XX:XX:XX:XX:XX<br />
<br />
== Using Obex for sending and receiving files ==<br />
<br />
=== Using GNOME tools ===<br />
I am using a Palm Treo 650 and have successfully been able to send files both ways between the phone and my Arch box. Pairing the device as instructed above, I checked that I had installed the following<br />
# pacman -S gnome-bluetooth bluez-gnome bluez-libs bluez-utils<br />
<br />
I used this link to add a Bluetooth entry to the SendTo menu in thunar's file properties menu: http://thunar.xfce.org/pwiki/documentation/sendto_menu<br />
<br />
I then ran<br />
$ gnome-obex-server<br />
<br />
A blue tray icon will appear. Now I am able to right-click any file in thunar, go to the SendTo menu and hit "Bluetooth OBEX Recipient." I then choose the device and send the file. Likewise, using the send via bluetooth option on my Palm I am able to send a file to the Arch box, where I see a receive dialog appear and can choose to accept it or not.<br />
<br />
In some cases, if you're told "send failure" when trying to receive file from mobile phone, you may need to open "Applications->System Tools->Bluetooth File Sharing".<br />
<br />
I can't guarantee this working for every phone or combination, but I also tried it with a Nokia E65 and was successful. -[mailto:brownitus@gmail.com colbert]<br />
<br />
=== Using Obexfs ===<br />
Another option rather than using KDE or Gnome Bluetooth packages is Obexfs which allows you to mount your phone and treat it as part of your filesystem. Note that to use Obexfs, you need a device that provides an Obex FTP service.<br />
<br />
To install;<br />
# pacman -S obexfs<br />
<br />
and then your phone can then be mounted running as root <br />
# obexfs -b <devices mac address> /mountpoint<br />
<br />
For more mounting options see http://dev.zuckschwerdt.org/openobex/wiki/ObexFs<br />
<br />
== Resources ==<br />
*[http://www.bluez.org Official Linux Bluetooth protocol stack]<br />
*[http://www.holtmann.org/linux/bluetooth/devices.html List of Linux supported Bluetooth Hardware]<br />
*[http://www.gentoo.org/doc/en/bluetooth-guide.xml Gentoo wiki is usually good]<br />
*[http://linuxgazette.net/109/oregan3.html Accessing a Bluetooth phone on Linux Gazette]</div>Leeyeehttps://wiki.archlinux.org/index.php?title=Hard_Drive_Active_Protection_System&diff=59075Hard Drive Active Protection System2009-01-24T08:35:26Z<p>Leeyee: /* hdapsd */</p>
<hr />
<div>This page describes how to install HDAPS on your Arch Linux installation. HDAPS stands for "Hard Drive Active Protection System." Its purpose is to protect your hard drive from sudden shocks (such as dropping or banging your laptop on a desk). It does this by parking the disk heads, so that shocks don't cause them to crash into the drive's platters. Hopefully, this will prevent catastrophic failure.<br />
<br />
As of Linux 2.6.28, the kernel has the ability to park disk heads on demand. Previously, this had to be patched into the kernel. Thanks to the kernel devs' hard work, we no longer have to rebuild our kernel to use this feature. Obviously, this means you need to be running 2.6.28 to follow this guide.<br />
<br />
==Shock Detection==<br />
Your hardware needs to support some kind of shock detection. This is usually in the form of an accelerometer built into your laptop's motherboard. If you have the hardware, you also need a way to communicate what the hardware is detecting to your operating system. This section describes drivers to communicate the accelerometer's state to the OS so it can detect and protect against shocks.<br />
<br />
===tp_smapi===<br />
[[tp_smapi]] is a set of drivers for ThinkPad laptops. It is highly recommended if you have a ThinkPad, even if you don't plan to use HDAPS. Among a plethora of other useful things, tp_smapi represents the accelerometer output as joystick devices <code>/dev/js#</code> (Note! This could interfere with other joystick devices on your system). <br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=3985 tp_smapi] from AUR. After installing, add <code>tp_smapi</code> to your <code>MODULES</code> array. After a reboot, this will activate most of the drivers, represented through the <code>/sys/devices/platform/smapi</code> filesystem.<br />
<br />
The kernel provides its own HDAPS drivers. For this reason, the HDAPS part of tp_smapi is built separately. Attempting to add <code>hdaps</code> to your <code>MODULES</code> array will result in the default drivers being loaded. This is not what we want, as we have our special ThinkPad HDAPS drivers. Instead, modify your /etc/rc.local and add the following line:<br />
<br />
insmod /lib/modules/2.6.28-ARCH/extra/hdaps.ko<br />
<br />
This will load the ThinkPad HDAPS module at the end of the initialization sequence.<br />
<br />
==Shock Protection==<br />
Now that your hardware is reporting its shock detection to the OS, we need to do something with this data. This section describes software utilities to transform the sensor output into shock protection.<br />
<br />
===hdapsd===<br />
hdapsd monitors the output of the HDAPS joystick devices to determine if a shock is about to occur, then tells the kernel to park the disk heads.<br />
<br />
Install [http://aur.archlinux.org/packages.php?ID=5401 hdapsd] from AUR. Be sure to review <code>/etc/conf.d/hdapsd</code> to ensure that it's protecting the correct hard drive.<br />
<br />
Because we have to load the hdaps module in <code>rc.local</code>, which executes after the DAEMONS array is loaded, we have to put hdapsd in rc.local instead of in DAEMONS like usual. Modify <code>/etc/rc.local</code> again, putting this line after the insmod added above:<br />
/etc/rc.d/hdapsd start<br />
After a reboot, your computer will now monitor the joystick devices and park your disk heads to protect it against shocks.<br />
<br />
Reboot your computer at this point. After init, if you jiggle your laptop, you should be able to hear the hard drive park. Don't do this too much <code>:)</code><br />
<br />
==GUI Utilities==<br />
Utilities exist to monitor hdapsd's status so you know what's going on while you're using your laptop. These are entirely optional, but very handy.<br />
<br />
===gnome-hdaps-applet===<br />
This is a GNOME panel applet (Note: XFCE can use GNOME panel applets) that represents the current status of your hard drive. If the disk heads are parked by hdapsd, this applet will reflect that. Unfortunately, the AUR project for gnome-hdaps-applet is very out of date and does not work any longer. This should be fixed, but for now, here's how to do it manually. Note that pacman '''will not''' manage these files. If you update this applet later, you'll have to manually remove and replace these files.<br />
<br />
First, grab the latest gnome-hdaps-applet sources from the [http://www.zen24593.zen.co.uk/hdaps/ this HDAPS mirror]. As of this writing, this is version <code>20081204</code>. Inflate these files, and follow the instructions in <code>INSTALL</code>. It's very straight-forward. When you're done, keep the <code>INSTALL</code> file around for future reference if you have to update or uninstall the applet later. Again, remember that pacman will not manage these files for you in any way.<br />
<br />
===khdapsmonitor===<br />
A KDE version exists as well. [http://aur.archlinux.org/packages.php?ID=12679 khdapsmonitor] in AUR. (Someone who uses KDE, please research and update this section.)<br />
<br />
==See Also==<br />
[http://www.thinkwiki.org/wiki/How_to_protect_the_harddisk_through_APS How to protect the harddisk through APS at ThinkWiki]<br />
<br />
[http://www.thinkwiki.org/wiki/HDAPS HDAPS at ThinkWiki]</div>Leeyee