Bluetooth
Questa guida si occuperà di spiegare passo passo come installare una periferica bluetooth su slackware 11. Le periferiche bluetooth che consentono la connettività tra telefonini, stampanti auricolari ecc ecc. L'implementazione di queste periferiche è ormai ben radicata nel kernel ma il progetto che le gestisce ha fatto un drastico cambiamento inserendo il supporto per dbus. Questo ha creato non pochi problemi, dovuti non solo alla gestione delle dipendeze (su slackware in particolare) ma anche alla gestione delle regole di dbus.
Il necessario
- i pacchetti del progetto bluez (www.bluez.org)
- dbus (nella versione consigliato su bluez)
- il vostro editor di testo preferito
- diritti di root
- sorgenti del kernel
Messa in opera
Se avete scaricato i pacchetti da Slacky.it potete passare direttamente alla sezione configurazione
Kernel
Se il kernel da voi in uso è diverso da quello di default di Slackware 11, sarà necessario compilare anche
Networking ---> <*> Bluetooth subsystem support ---> --- Bluetooth subsystem support <M> L2CAP protocol support <M> SCO links support <M> RFCOMM protocol support [*] RFCOMM TTY support <M> BNEP protocol support [*] Multicast filter support [*] Protocol filter support <M> HIDP protocol support Bluetooth device drivers ---> <M> HCI USB driver [*] SCO (voice) support <M> HCI UART driver [*] UART (H4) protocol support [*] BCSP protocol support [*] Transmit CRC with every BCSP packet <M> HCI BCM203x USB driver <M> HCI BPA10x USB driver <M> HCI BlueFRITZ! USB driver <M> HCI DTL1 (PC Card) driver <M> HCI BT3C (PC Card) driver <M> HCI BlueCard (PC Card) driver <M> HCI UART (PC Card) device driver <M> HCI VHCI (Virtual HCI device) driver
Ricompilando in kernel avrete così a disposizione i moduli per il supporto bluetooth.
Bluez
I pacchetti di bluez sono:
- bluez-firmware
- bluez-hcidump
- bluez-libs
- bluez-utils
Quindi per compilarli e installarli
tar zxvpf bluez-libs*.tar.gz cd bluez-libs* ./configure --prefix=/usr make if `checkinstall -v &> /dev/null`; then checkinstall; installpkgbluez-libs*.tgz; else make install; fi cd .. tar zxvpf bluez-firmware*.tar.gz cd bluez-firmware* ./configure --prefix=/usr if `checkinstall -v &> /dev/null`; then checkinstall; installpkg bluez-firmware*; else make install; fi tar zxvpf bluez-hcidump*.tar.gz cd bluez-hcidump* ./configure --prefix=/usr make if `checkinstall -v &> /dev/null`; then checkinstall; installpkg bluez-hcidump*; else make install; fi tar zxvpf bluez-utils*.tar.gz cd bluez-utils* ./configure --prefix=/usr make if `checkinstall -v &> /dev/null`; then checkinstall; installpkg bluez-utils*.tgz; else make install; fi
A questo punto il sistema è quasi pronto per funzionare.
Configurazione
Ci serve ora uno script che faccia partire il sistema, nei pacchetti di slacky è giò inserito ma c'è una piccola modifica da fare (/etc/rc.d/rc.bluetooth.conf):
#!/bin/sh # # Start/stop the Bluetooth daemons # # This version has been modified by SukkoPera, taking inspiration from then # Debian init script, to add support for register-passkeys # Edited by L1q1d for enabling the discovery system. # set -e PATH=/sbin:/bin:/usr/sbin:/usr/bin NAME=bluetooth DESC="Bluetooth subsystem" # This script was stolen from Debian REGISTER_PASSKEYS=/usr/lib/bluetooth/register-passkeys HCID_NAME=hcid SDPD_NAME=sdpd HIDD_NAME=hidd HID2HCI_NAME=hid2hci RFCOMM_NAME=rfcomm PAND_NAME=pand DUND_NAME=dund HCID_EXEC="`which $HCID_NAME || true`" SDPD_EXEC="`which $SDPD_NAME || true`" HIDD_EXEC="`which $HIDD_NAME || true`" HID2HCI_EXEC="`which $HID2HCI_NAME || true`" RFCOMM_EXEC="`which $RFCOMM_NAME || true`" PAND_EXEC="`which $PAND_NAME || true`" DUND_EXEC="`which $DUND_NAME || true`" HCID_ENABLE=true SDPD_ENABLE=true HIDD_ENABLE=false HID2HCI_ENABLE=false RFCOMM_ENABLE=true DUND_ENABLE=false PAND_ENABLE=false HCID_CONFIG="/etc/bluetooth/hcid.conf" RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf" HIDD_OPTIONS="" DUND_OPTIONS="" PAND_OPTIONS="" [ -e /etc/rc.d/rc.bluetooth.conf ] && . /etc/rc.d/rc.bluetooth.conf case "$1" in start) echo -n "Starting $DESC:" if $HCID_ENABLE && [ -x "$HCID_EXEC" -a -f "$HCID_CONFIG" ] ; then $HCID_EXEC -f $HCID_CONFIG echo -n " $HCID_NAME" fi if $SDPD_ENABLE && [ -x "$SDPD_EXEC" ] ; then $SDPD_EXEC echo -n " $SDPD_NAME" fi if $HIDD_ENABLE && [ -x "$HIDD_EXEC" ] ; then $HIDD_EXEC $HIDD_OPTIONS --server || true echo -n " $HIDD_NAME" fi if $HID2HCI_ENABLE && [ -x "$HID2HCI_EXEC" ] ; then $HID2HCI_EXEC --tohci > /dev/null 2>&1 || true echo -n " $HID2HCI_NAME" fi if $RFCOMM_ENABLE && [ -x "$RFCOMM_EXEC" -a -f "$RFCOMM_CONFIG" ] ; then $RFCOMM_EXEC -f $RFCOMM_CONFIG bind all || true echo -n " $RFCOMM_NAME" fi if $DUND_ENABLE && [ -x "$DUND_EXEC" -a -n "$DUND_OPTIONS" ] ; then $DUND_EXEC $DUND_OPTIONS echo -n " $DUND_NAME" fi if $PAND_ENABLE && [ -x "$PAND_EXEC" -a -n "$PAND_OPTIONS" ] ; then $PAND_EXEC $PAND_OPTIONS echo -n " $PAND_NAME" fi if [ -x $REGISTER_PASSKEYS ]; then $REGISTER_PASSKEYS echo -n " passkeys" fi echo "." # Piccola modifica da apportare <---- echo "Enabling d-bus discovery" dbus-send --system --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.SetMode string:discoverable ;; stop) echo -n "Stopping $DESC:" killall $PAND_NAME > /dev/null 2>&1 || true echo -n " $PAND_NAME" killall $DUND_NAME > /dev/null 2>&1 || true echo -n " $DUND_NAME" if [ -x "$RFCOMM_EXEC" ] ; then $RFCOMM_EXEC release all > /dev/null 2>&1 || true echo -n " $RFCOMM_NAME" fi killall $HIDD_NAME > /dev/null 2>&1 || true echo -n " $HIDD_NAME" killall $SDPD_NAME > /dev/null 2>&1 || true echo -n " $SDPD_NAME" killall $HCID_NAME > /dev/null 2>&1 || true echo -n " $HCID_NAME" echo "." ;; *) N=/etc/rc.d/$NAME echo "Usage: $N {start|stop}" >&2 exit 1 ;; esac exit 0
Con il suo file di configurazione (/etc/rc.d/rc.bluetooth.conf):
# Bluetooth configuraton file # Start of hcid (allowed values are "true" and "false") HCID_ENABLE=true # Config file for hcid HCID_CONFIG="/etc/bluetooth/hcid.conf" # Start sdpd (allowed values are "true" and "false") SDPD_ENABLE=true # Start hidd (allowed values are "true" and "false") HIDD_ENABLE=false # Arguments to hidd HIDD_OPTIONS="" # Run hid2hci (allowed values are "true" and "false") HID2HCI_ENABLE=false # Bind rfcomm devices (allowed values are "true" and "false") RFCOMM_ENABLE=true # Config file for rfcomm RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf" # Start dund (allowed values are "true" and "false") DUND_ENABLE=false # Arguments to dund DUND_OPTIONS="--listen --persist" # Start pand (allowed values are "true" and "false") PAND_ENABLE=false # Arguments to pand PAND_OPTIONS="--listen --role NAP" <pre> A questo punto creaimo le regole per i moduli da caricare: <pre>cat << EOF > /etc/modprobe.d/bluetooth alias bt-proto-0 l2cap alias bt-proto-2 sco alias bt-proto-3 rfcomm ctrl + d
Non ci resta che caricare i moduli:
modprobe bluez | bluetooth modprobe l2cap modprobe sco modprobe rfcomm