summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Nascimento Ferreira <lucasferreira@freedesktop.org>2010-06-09 12:00:29 -0300
committerLucas Nascimento Ferreira <lucasferreira@freedesktop.org>2010-06-09 12:00:29 -0300
commit2cf2b4363c84d5ab5e2b57ee1698f4df459594e1 (patch)
treec3d6a2394b7a2c923553bb5549eaed84384daab8
Initial Commit. Udev rules to auto detect the Dock Stations and
a script to label the devices with a commmon seat ID.
-rw-r--r--README1
-rwxr-xr-xsrc/seat-id54
-rw-r--r--udev/50-usbseat.rules18
3 files changed, 73 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..853f613
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+Lucas Ferreira GSOC 2010 project
diff --git a/src/seat-id b/src/seat-id
new file mode 100755
index 0000000..f12be6e
--- /dev/null
+++ b/src/seat-id
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+SEAT_PATH="/dev/usbseat/"
+
+mkdir -p $SEAT_PATH
+
+SEAT_NAME=
+DEV_BUS=$(cut -d'.' -f1 <<< $1)
+SEAT_AMOUNT=$(ls $SEAT_PATH | wc -l)
+
+if [ $SEAT_AMOUNT == 0 ]; then
+
+ SEAT_NAME="seat1"
+ echo $DEV_BUS > $SEAT_PATH/.${SEAT_NAME}_bus
+else
+
+ for SEAT in $(ls ${SEAT_PATH}); do
+
+ # If the new device comes from one already existant Dock Station,
+ # atribute it this same Dock.
+ if [ "$DEV_BUS" == "$(cat $SEAT_PATH/.${SEAT}_bus)" ]; then
+
+ SEAT_NAME="$SEAT"
+ echo $SEAT_NAME
+
+ exit
+ fi
+ done
+
+ # If the new device comes from one still not existant Dock Station,
+ # create a new one
+ if [ "$SEAT_NAME" == "" ] && [ "$SEAT" == "seat${SEAT_AMOUNT}" ]; then
+
+ SEAT_NAME="seat$((SEAT_AMOUNT + 1))"
+ echo $DEV_BUS > $SEAT_PATH/.${SEAT_NAME}_bus
+ else
+
+ if [ "$SEAT_NAME" == "" ] && [ "$SEAT" > "seat${SEAT_AMOUNT}" ]; then
+
+ SEAT_NUMBER=${SEAT#seat}
+ SEAT_NAME="seat$((SEAT_NUMBER - 1))"
+
+ while [ -d "$SEAT_PATH/$SEAT_NAME" ]; do
+
+ SEAT_NUMBER=$((SEAT_NUMBER - 1))
+ SEAT_NAME="seat${SEAT_NUMBER}"
+ done
+
+ echo $DEV_BUS > $SEAT_PATH/.${SEAT_NAME}_bus
+ fi
+ fi
+fi
+
+echo $SEAT_NAME
diff --git a/udev/50-usbseat.rules b/udev/50-usbseat.rules
new file mode 100644
index 0000000..c083359
--- /dev/null
+++ b/udev/50-usbseat.rules
@@ -0,0 +1,18 @@
+# set all DisplayLink devices to configuration 1
+# see http://libdlo.freedesktop.org/wiki/DeviceQuirks for more info
+ATTR{idVendor}=="17e9", ATTR{bConfigurationValue}=="2", RUN="/bin/echo 1 > /sys/%b/bConfigurationValue"
+
+# aliases for display, kbd, mouse attached to specific hubs
+
+KERNEL=="fb*",SUBSYSTEMS=="usb", PROGRAM="/bin/seat-id %b", SYMLINK+="usbseat/%c/display",RUN+="usbseat.sh %c"
+
+KERNEL=="mouse*", SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", PROGRAM="/bin/seat-id %b",SYMLINK+="usbseat/%c/mouse",RUN+="usbseat.sh %c"
+
+KERNEL=="event*", SUBSYSTEM=="input", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01",PROGRAM="/bin/seat-id %b",SYMLINK+="usbseat/%c/keyboard",RUN+="usbseat.sh %c"
+
+KERNEL=="control*", SUBSYSTEM=="sound", SUBSYSTEMS=="usb", PROGRAM="/bin/seat-id %b", SYMLINK+="usbseat/%c/sound"
+
+# Handle when keyboard and mouse are one more hub downstream. Relying on pnp order to have already set up mouse, keyboard on upstream hub if we're daisy-chaining
+KERNEL=="event*", SUBSYSTEM=="input", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01",PROGRAM="/bin/seat-id %b",SYMLINK+="usbseat/%c/keyboard",RUN+="usbseat.sh %c"
+
+KERNEL=="mouse*", SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", PROGRAM="/bin/seat-id %b",SYMLINK+="usbseat/%c/mouse",RUN+="usbseat.sh %c"