Welcome to my Site

Welcome to my site! I will write here about Arch Linux, open source, my Jolla Devices, Raspberry Pi and other stuff that interests me. Have fun looking around! If you have questions, suggestions or corrections feel free to leave a comment or send me an email.

Blog Posts

Autostarting gnome-obex-server

Autostarting gnome-obex-server on USB-BT-Stick insertion

I Have an USB-Bluetooth-Stick which for my Laptop. Since the stick is not always present at the Laptop I only want gnome-obex-server to run if the bt-stick is really there. To do this I use a simple script and an udev-rule:

The scripts and rules

/etc/scripts/obex

  #!/bin/bash 
  case "$ACTION" in 
    "add") 
      (export DISPLAY=":0.0" && sleep 4 && su seiichiro -c gnome-obex-server) &
      ;;
    "remove")
      killall gnome-obex-server
      ;;
  esac

(note: seiichiro should be replaced with your normal X11-User)

and finally the udev-rule that make all the magic happen (insert them into your lokal udev-rules):

KERNEL=="hci0", RUN+="/etc/scripts/obex" 

After this gnome-obex-server should start and stop itself whenever the BT-Stick is inserted/removed Note: this only works for a single user, for multiple different users a more complex script would be necessary.

start.txt · Last modified: 21.07.2016 04:43 by Seiichiro
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki netcup.de Recent changes RSS feed Valid XHTML 1.0