BluetoothをGUIで

追加アプリケーションパッケージ、PETやSFSなどの話題です

モデレータ: 暇人, YoN, nyu

きりん
記事: 553
登録日時: 08/02/24(日) 21:49
連絡する:

Re: BluetoothをGUIで

投稿記事 by きりん »

Windows Xpのサポート終了を意識して、puppyでの不足部分の補完を行っているところです。precise-571JPを当面中心に沿えたいと考えています。
パッケージを検索していたら、bluemanなどを使わない、軽量のツールがありました。
saveファイルを圧縮しないのでpuppyにぴったりなのですが、CUIツールなのでずぼらな扱いが出来るようにとgtkdialogでの補完を考えてみました。
マウスの接続実験しか現状出来ていませんが参考にアップしておきます。

1.必要なパッケージ

コード: 全て選択

bluez-tools_0.1.38+git662e-2ubuntu1_i386.deb
libcap-ng0_0.6.6-1ubuntu1_i386.deb
bluez_4.98-2ubuntu7_i386.deb
libbluetooth3_4.98-2ubuntu7_i386.deb
bluez-alsa_4.98-2ubuntu7_i386.deb
bluez-cups_4.98-2ubuntu7_i386.deb
obexd-client_0.44-0ubuntu1_i386.deb
obexd-server_0.44-0ubuntu1_i386.deb
python-dbus-dev_1.0.0-1ubuntu1_all.deb
python-dbus_1.0.0-1ubuntu1_i386.deb
始めの4つのパッケージが最小限必要です。接続するデバイスの種類によって、続くパッケージが必要になります。
python〜は付属されているサンプルを実行しない限り必要ないようです。python本体はdevx.sfsに含まれているのでこれを利用するのが便利です。パッケージのインストールの最、ドキュメントやロケールをダイエットすることが出来ますがサンプルや説明書が削除されてしまうのでダイエットは避けた方がよいと思います。
説明書の内容は具体的な使い方が示されていないので、実例として次のサイトの情報が判り易いと思います。
http://wiki.openelec.tv/index.php/Bluez-tools_how-to

2.簡単なGUIの例
道中場ですが、参考に上げておきます。
/root/my-applications/bin/bt-tool-gtkdialog.sh

コード: 全て選択

#! /bin/bash
# Bluetooth-tools を利用したgtkdialogスクリプト

export MAIN_DIALOG='
<window title="BT tools">
 <vbox>
  <notebook labels="デバイス|ペアリング|アダプター|転送">
   <vbox>
    <table>
     <variable>TABLE1</variable>
     <width>700</width><height>200</height>
     <input>cat /tmp/bt-device-info.txt</input>
    </table>
    <hbox>
     <button><label>デバイス一覧</label>
      <action> bt-device -l >/tmp/bt-device-info.txt </action>
      <action type="Clear">TABLE1</action>
      <action type="refresh">TABLE1</action>
     </button>
     <button><label>選択デバイス詳細</label>
      <action> echo $TABLE1 | cut -d"(" -f2 | cut -d")" -f1 >/tmp/bt-addr.txt </action>
      <action> bt-device -i `cat /tmp/bt-addr.txt` >/tmp/bt-device-info.txt </action>
      <action type="Clear">TABLE1</action>
      <action type="refresh">TABLE1</action>
     </button>
     <button><label>選択デバイスの削除</label>
      <action> echo $TABLE1 | cut -d"(" -f2 | cut -d")" -f1 >/tmp/bt-addr.txt </action>
      <action> bt-device -r `cat /tmp/bt-addr.txt` >/tmp/bt-device-info.txt </action>
      <action type="Clear">TABLE1</action>
      <action type="refresh">TABLE1</action>
     </button>
    </hbox>
   </vbox>
   <vbox>
    <table>
     <variable>TABLE2</variable>
     <width>700</width><height>200</height>
     <input> cat /tmp/bt-pair.txt </input>
    </table>
    <text>
     <input> cat /tmp/bt-addr.txt </input>
     <variable>ADDR</variable>
    </text>
    <hbox>
     <button><label>検出</label>
      <action> rxvt -e bt-s-discover.sh </action>
      <action type="Clear">TABLE2</action>
      <action type="refresh">TABLE2</action>
     </button>
     <button><label>デバイス選択</label>
      <action>echo $TABLE2 | sed -e "s/Address://" >/tmp/bt-addr.txt</action>
      <action type="refresh">ADDR</action>
     </button>
     <button><label>接続(input dev)</label>
      <action> rxvt -e bt-s-input.sh </action>
      <action type="Clear">TABLE2</action>
      <action type="refresh">TABLE2</action>
     </button>
     </hbox>
    </vbox>
    <vbox>
     <edit>
      <variable>EDITOR3</variable>
      <width>700</width><height>200</height>
      <input file>/tmp/bt-adapter-info.txt</input>
     </edit>
     <hbox>
      <button><label>検出可</label>
       <action> bt-adapter --set Discoverable 1 >/dev/null </action>
       <action> bt-adapter -i >/tmp/bt-adapter-info.txt </action>
       <action type="refresh">EDITOR3</action>
      </button>
      <button><label>検出不可</label>
       <action> bt-adapter --set Discoverable 0 >/dev/null </action>
       <action> bt-adapter -i >/tmp/bt-adapter-info.txt </action>
       <action type="refresh">EDITOR3</action>
      </button>
      <button><label>リフレッシュ</label>
       <action> bt-adapter -i >/tmp/bt-adapter-info.txt </action>
       <action type="refresh">EDITOR3</action>
      </button>
     </hbox>
    </vbox>
    <tree>
     <input file>tmp.text</input>
     <label>First</label>
     <item stock="gtk-floppy">This is a floppy</item>
     <item stock="gtk-cdrom">This is a CD-ROM</item>
     <item>This line has no icon</item>
     <variable>EDITOR</variable>
    </tree>
   </notebook>
   <hbox>
    <button cancel></button>
    <button ok></button>
   </hbox>
  </vbox>
</window>
'

# bluetoothd の存在を確認する。存在しなければアボート
if ! [ -x /usr/sbin/bluetoothd ] ; then
  echo "not find bluetoothd"
  exit
fi

# bluetoothd が動作中か確認
if ! ps axc | grep -w bluetoothd >/dev/null ;then
  echo "bluetoothd not runing"
  exit
fi

bt-device -l >/tmp/bt-device-info.txt
echo "検出ボタンを押してください" >/tmp/bt-pair.txt
echo "non" >/tmp/bt-addr.txt
bt-adapter -i >/tmp/bt-adapter-info.txt

gtkdialog3 --program=MAIN_DIALOG
/root/my-applications/bin/bt-s-discover.sh

コード: 全て選択

#!/bin/sh
bt-adapter -d | tee /tmp/bt-pair.txt
/root/my-applications/bin/bt-s-input.sh

コード: 全て選択

#!/bin/sh
ADDR=`cat /tmp/bt-addr.txt`
bt-device -c $ADDR
bt-input -c $ADDR
bt-device --set $ADDR Trusted 1
きりん
記事: 553
登録日時: 08/02/24(日) 21:49
連絡する:

Re: Bluetooth on slacko-5.9.3

投稿記事 by きりん »

定期便的な情報ですいません。
slacko-5.9.3 での作業です。ハードは、eeePC901を使いました。

1.必要ファイルのインストール
devxを組み込みの上、次のファイルが必要です。
予め組み込まれている dbus では、途中でエラーが出たので、入れ替えを行っています。dbus-1.6.12 と dbus-glib-0.100.2
pass key の入力を行うための、notifyとして、xfce4-notifyd-0.2.4 がやっぱり必要です。
/root/.packages/user-installed-packages

コード: 全て選択

bluez-firmware-1.2|bluez-firmware|1.2|1|BuildingBlock|170K|slackware/n|bluez-firmware-1.2-i486-1.txz||Bluetooth|slackware|14.1|
bluez-4.99|bluez|4.99|3|BuildingBlock|3080K|slackware/n|bluez-4.99-i486-3.txz|+alsa-lib,+dbus,+glib2,+gst-plugins-base,+gstreamer,+libffi,+libusb,+libusb-compat,+libxml2,+udev,+xz,+zlib|Bluetooth libraries and utilities|slackware|14.1|
gst-plugins-base-0.10.36|gst-plugins-base|0.10.36|2|BuildingBlock|10860K|slackware/l|gst-plugins-base-0.10.36-i486-2.txz|+gstreamer,+util-linux,+xz,+zlib,+cdparanoia,+harfbuzz,+libogg,+libpng,+libtheora,+libvisual,+libvorbis|base set of GStreamer plugins|slackware|14.1|
gstreamer-0.10.36|gstreamer|0.10.36|2|BuildingBlock|13290K|slackware/l|gstreamer-0.10.36-i486-2.txz|+glib2,+libffi,+libxml2,+xz,+zlib|streaming multimedia framework|slackware|14.1|
libvisual-0.4.0|libvisual|0.4.0|3|BuildingBlock|590K|slackware/l|libvisual-0.4.0-i486-3.txz||audio visualization library|slackware|14.1|
bluez-hcidump-2.4|bluez-hcidump|2.4|1|BuildingBlock|420K|slackware/n|bluez-hcidump-2.4-i486-1.txz|+bluez|Bluetooth analyzer|slackware|14.1|
blueman-r708|blueman|r708|3|BuildingBlock|3510K|slackware/xap|blueman-r708-i486-3.txz|+atk,+bluez,+bzip2,+cairo,+cxxlibs,+gcc-g++,+expat,+fontconfig,+freetype,+gcc,+gdk-pixbuf2,+glib2,+gtk+2,+harfbuzz,+icu4c,+libX11,+libXau,+libXcomposite,+libXcursor,+libXdamage,+libXdmcp,+libXext,+libXfixes,+libXi,+libXinerama,+libXrandr,+libXrender,+libffi,+libpng,+libxcb,+pango,+pixman,+python,+startup-notification,+xcb-util,+zlib|Graphical Bluetooth Manager|slackware|14.1|
notify-python-0.1.1|notify-python|0.1.1|3|BuildingBlock|80K|slackware/l|notify-python-0.1.1-i486-3.txz|+atk,+bzip2,+cairo,+cxxlibs,+gcc-g++,+expat,+fontconfig,+freetype,+gcc,+gdk-pixbuf2,+glib2,+gtk+2,+harfbuzz,+icu4c,+libX11,+libXau,+libXcomposite,+libXcursor,+libXdamage,+libXdmcp,+libXext,+libXfixes,+libXi,+libXinerama,+libXrandr,+libXrender,+libffi,+libnotify,+libpng,+libxcb,+pango,+pixman,+zlib,+python|Python bindings for libnotify|slackware|14.1|
pygobject-2.28.6|pygobject|2.28.6|2|BuildingBlock|3410K|slackware/l|pygobject-2.28.6-i486-2.txz|+glib2,+libffi,+zlib|GObject bindings for Python|slackware|14.1|
pygtk-2.24.0|pygtk|2.24.0|1|BuildingBlock|16610K|slackware/l|pygtk-2.24.0-i486-1.txz|+atk,+bzip2,+cairo,+cxxlibs,+gcc-g++,+expat,+fontconfig,+freetype,+gcc,+gdk-pixbuf2,+glib2,+gtk+2,+harfbuzz,+icu4c,+libX11,+libXau,+libXcomposite,+libXcursor,+libXdamage,+libXdmcp,+libXext,+libXfixes,+libXi,+libXinerama,+libXrandr,+libXrender,+libffi,+libglade,+libpng,+libxcb,+libxml2,+pango,+pixman,+xz,+zlib,+python|GTK+ bindings for Python|slackware|14.1|
dbus-python-1.2.0|dbus-python|1.2.0|1|BuildingBlock|750K|slackware/l|dbus-python-1.2.0-i486-1.txz|+dbus,+dbus-glib,+glib2,+libffi,+zlib,+python|Python bindings for dbus|slackware|14.1|
pycairo-1.8.10|pycairo|1.8.10|2|BuildingBlock|190K|slackware/l|pycairo-1.8.10-i486-2.txz|+bzip2,+cairo,+expat,+fontconfig,+freetype,+libX11,+libXau,+libXdmcp,+libXext,+libXrender,+libpng,+libxcb,+pixman,+zlib|a set of Python bindings for the cairo graphics library|slackware|14.1|
dbus-1.6.12|dbus|1.6.12|1|BuildingBlock|1920K|slackware/a|dbus-1.6.12-i486-1.txz|+expat,+util-linux|D Bus message bus system|slackware|14.1|
dbus-glib-0.100.2|dbus-glib|0.100.2|1|BuildingBlock|820K|slackware/l|dbus-glib-0.100.2-i486-1.txz|+dbus,+expat,+glib2,+libffi,+zlib|Glib bindings for dbus|slackware|14.1|
djvulibre-3.5.25.3|djvulibre|3.5.25.3|1|BuildingBlock|3050K|slackware/l|djvulibre-3.5.25.3-i486-1.txz|+cxxlibs,+gcc-g++,+gcc,+libjpeg,+libtiff,+zlib|web centric document and image format|slackware|14.1|
fftw-3.3.3|fftw|3.3.3|1|BuildingBlock|14630K|slackware/l|fftw-3.3.3-i486-1.txz|+gcc|Fastest Fourier Transform in the West|slackware|14.1|
ilmbase-1.0.3|ilmbase|1.0.3|1|Utility;shell|1000K|slackware/l|ilmbase-1.0.3-i486-1.txz|+cxxlibs,+gcc-g++,+gcc|Industrial Light  Magic base libraries|slackware|14.1|
imagemagick-6.8.6_10|imagemagick|6.8.6_10|1|BuildingBlock|17650K|slackware/xap|imagemagick-6.8.6_10-i486-1.txz|+bzip2,+cairo,+cxxlibs,+gcc-g++,+djvulibre,+expat,+fftw,+fontconfig,+freetype,+gcc,+gdk-pixbuf2,+glib2,+harfbuzz,+icu4c,+ilmbase,+jasper,+lcms2,+libICE,+libSM,+libX11,+libXau,+libXdmcp,+libXext,+libXrender,+libXt,+libcroco,+libffi,+libjpeg,+libpng,+librsvg,+libtiff,+libxcb,+libxml2,+openexr,+pango,+pixman,+util-linux,+xz,+zlib|a robust collection of image processing tools|slackware|14.1|
openexr-1.7.1|openexr|1.7.1|1|Utility;shell|4230K|slackware/l|openexr-1.7.1-i486-1.txz|+cxxlibs,+gcc-g++,+gcc,+ilmbase,+zlib|HDR Image File Format  Library|slackware|14.1|
openobex-1.5|openobex|1.5|1|BuildingBlock|190K|slackware/n|openobex-1.5-i486-1.txz|+bluez,+libusb,+libusb-compat|Object Exchange protocol library|slackware|14.1|
obex-data-server-0.4.6|obex-data-server|0.4.6|2|BuildingBlock|230K|slackware/n|obex-data-server-0.4.6-i486-2.txz|+bluez,+bzip2,+cairo,+cxxlibs,+gcc-g++,+dbus,+dbus-glib,+djvulibre,+expat,+fftw,+fontconfig,+freetype,+gcc,+gdk-pixbuf2,+glib2,+harfbuzz,+icu4c,+ilmbase,+imagemagick,+jasper,+lcms2,+libICE,+libSM,+libX11,+libXau,+libXdmcp,+libXext,+libXrender,+libXt,+libcroco,+libffi,+libjpeg,+libpng,+librsvg,+libtiff,+libusb,+libusb-compat,+libxcb,+libxml2,+openexr,+openobex,+pango,+pixman,+util-linux,+xz,+zlib|Obex D Bus Service Support|slackware|14.1|
libxfce4ui-4.10.0|libxfce4ui|4.10.0|2|BuildingBlock|1110K|slackware/xfce|libxfce4ui-4.10.0-i486-2.txz|+atk,+bzip2,+cairo,+cxxlibs,+gcc-g++,+dbus,+dbus-glib,+expat,+fontconfig,+freetype,+gcc,+gdk-pixbuf2,+glib2,+gtk+2,+harfbuzz,+icu4c,+libICE,+libSM,+libX11,+libXau,+libXcomposite,+libXcursor,+libXdamage,+libXdmcp,+libXext,+libXfixes,+libXi,+libXinerama,+libXrandr,+libXrender,+libffi,+libpng,+libxcb,+libxfce4util,+libxml2,+pango,+pixman,+startup-notification,+util-linux,+xcb-util,+xfconf,+xz,+zlib|Xfce widget library|slackware|14.1|
libxfce4util-4.10.1|libxfce4util|4.10.1|1|BuildingBlock|870K|slackware/xfce|libxfce4util-4.10.1-i486-1.txz|+glib2|basic utility library for Xfce|slackware|14.1|
xfconf-4.10.0|xfconf|4.10.0|1|BuildingBlock|920K|slackware/xfce|xfconf-4.10.0-i486-1.txz|+dbus,+dbus-glib,+glib2,+libffi,+libxfce4util,+zlib|Xfce configuration storage system|slackware|14.1|
xfce4-notifyd-0.2.4|xfce4-notifyd|0.2.4|1|BuildingBlock|370K|slackware/xfce|xfce4-notifyd-0.2.4-i486-1.txz|+atk,+bzip2,+cairo,+cxxlibs,+gcc-g++,+dbus,+dbus-glib,+expat,+fontconfig,+freetype,+gcc,+gdk-pixbuf2,+glib2,+gtk+2,+harfbuzz,+icu4c,+libICE,+libSM,+libX11,+libXau,+libXcomposite,+libXcursor,+libXdamage,+libXdmcp,+libXext,+libXfixes,+libXi,+libXinerama,+libXrandr,+libXrender,+libffi,+libnotify,+libpng,+libxcb,+libxfce4ui,+libxfce4util,+pango,+pixman,+startup-notification,+util-linux,+xcb-util,+xfconf,+zlib|Xfce Notify Daemon|slackware|14.1|
2.補助的に必要なファイル
python上の動作でpathをうまく見つけられないような動作があったので、次のファイルを追加しました。
/usr/lib/python2.7/site-packages/_add_path_gtk-2.0.pth

コード: 全て選択

./gtk-2.0
スタートアップファイルは以下のような内容としました。
/root/Startup/start-BT ※実行属性が必要です。

コード: 全て選択

#!/bin/sh
bluetoothd
blueman-applet
きりん
記事: 553
登録日時: 08/02/24(日) 21:49
連絡する:

GUI on precise-571JP

投稿記事 by きりん »

precise-571JP上でのblueman導入記録です。
devx.sfs中にpythonが組み込まれていますが、これを利用しようとするとパスが見つからないエラーが多く出ます。回避するため補助的に次にようにすると良いようです。

インストールしたパッケージ:python-support_1.0.14ubuntu2
これに含まれるコマンド、update-python-modules がpython関係のパッケージをインストールした後の不整合を修正してくれるようです。インストール後、動作させるとエラーがでますので次のファイルを補完する必要があります。
python-minimalパッケージの中にある、/usr/share/python/debian_defaults

bluemanを動作させるためにインストールしたパッケージは次のとおりです。

コード: 全て選択

python-dbus-dev_1.0.0|main loop integration development files for python-dbus
python-dbus_1.0.0|simple interprocess messaging system Python interface
python-gobject-2_2.28.6|deprecated static Python bindings for the GObject library
python-cairo_1.8.8|Python bindings for the Cairo vector graphics library
python-gtk2_2.24.0-3|Python bindings for the GTK+ widget set
bluez_4.98Bluetooth tools and daemons
gir1.2-glib-2.0_1.32.0-1|Introspection data for GLib GObject Gio and GModule
libbluetooth3_4.98Library to use the BlueZ Linux Bluetooth stack
libcanberra-gtk3-0_0.28|GTK+ 3.0 helper for playing widget event sounds with libcanberra
libcap-ng0_0.6.6|An alternate POSIX capabilities library
libgirepository-1.0-1_1.32.0-1|Library for handling GObject introspection data runtime library
libopenobex1_1.5|OBEX protocol library
libudev0_175|udev library
notification-daemon_0.7.3-1|daemon for displaying passive pop-up notifications
obex-data-server_0.4.6|D-Bus service for OBEX client and server side functionality
python-gi_3.2.2-1|Python 2.x bindings for gobject-introspection libraries
python-notify_0.1.1-3|Python bindings for libnotify
blueman_1.23|A Graphical bluetooth manager
libxfce4ui-1-0_4.8.1-1|widget library for Xfce
libxfce4util-common_4.8.2-1|Utility functions library for Xfce4
libxfconf-0-2_4.8.1-1|Client library for Xfce4 configure interface
xfce-keyboard-shortcuts_4.8.1-1|xfce keyboard shortcuts configuration
xfconf_4.8.1-1|utilities for managing settings in Xfce
xfce4-notifyd_0.2.2-1|simple visually-appealing notification daemon for Xfce
python-gconf_2.28.1+dfsg-1|Python bindings for the GConf configuration database system
libpulse-mainloop-glib0_1.1|PulseAudio client libraries glib support
gnome-icon-theme_3.4.0|GNOME Desktop icon theme small subset
コンソールから次のコマンドを叩くと起動します。確認後、/root/Startup に起動スクリプトとして登録します。

コード: 全て選択

# bluetoothd
# blueman-applet
既に作成されていれば不要ですが、手動で作成したディレクトリ;/root/.cache が必要です。

pythonは容量を結構食うので、devxに含まれるものを利用するのが自然な流れですが、ビルダー(ブリーダー?)の判断によって削除されているファイルが、puppyの特性としてあります。この辺の気付きが、いつも難しいな・・・
返信する