summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas N. Ferreira <lnf07@c3sl.ufpr.br>2010-07-30 02:32:49 -0300
committerLucas N. Ferreira <lnf07@c3sl.ufpr.br>2010-07-30 02:32:49 -0300
commitde792b755254c0f68d61dfbedf983e9593746c4a (patch)
treeff882ec3610180f696897f61b9defaeb7a1968ae
parent31fef89f597236a24271e6dde20c4cb2c9a266fa (diff)
Initialize seats automaticaly
-rw-r--r--etc/ConsoleKit/displays.d/Seat1.display5
-rw-r--r--etc/ConsoleKit/displays.d/Seat2.display5
-rw-r--r--etc/ConsoleKit/displays.d/usbseat.display5
-rw-r--r--etc/ConsoleKit/seats.d/01-usbseat.seat (renamed from etc/ConsoleKit/seats.d/01-seat1.seat)2
-rw-r--r--etc/ConsoleKit/seats.d/02-seat2.seat11
-rw-r--r--etc/ConsoleKit/sessions.d/Seat2.session8
-rw-r--r--etc/ConsoleKit/sessions.d/usbseat.session (renamed from etc/ConsoleKit/sessions.d/Seat1.session)1
-rw-r--r--etc/X11/xorg.conf.seat158
-rw-r--r--etc/X11/xorg.conf.seat258
-rw-r--r--etc/X11/xorg.conf.usbseat59
-rwxr-xr-xsrc/usbseat.sh53
-rw-r--r--udev/50-usbseat.rules10
12 files changed, 124 insertions, 151 deletions
diff --git a/etc/ConsoleKit/displays.d/Seat1.display b/etc/ConsoleKit/displays.d/Seat1.display
deleted file mode 100644
index 3ac6256..0000000
--- a/etc/ConsoleKit/displays.d/Seat1.display
+++ /dev/null
@@ -1,5 +0,0 @@
-[Display]
-Type=X11
-
-[X11]
-Exec=/opt/xorg/bin/X -config /etc/X11/xorg.conf.seat1 $display -br -audit 0 -verbose -auth $auth -nolisten tcp vt7
diff --git a/etc/ConsoleKit/displays.d/Seat2.display b/etc/ConsoleKit/displays.d/Seat2.display
deleted file mode 100644
index 4989831..0000000
--- a/etc/ConsoleKit/displays.d/Seat2.display
+++ /dev/null
@@ -1,5 +0,0 @@
-[Display]
-Type=X11
-
-[X11]
-Exec=/opt/xorg/bin/X -config /etc/X11/xorg.conf.seat2 $display -br -audit 0 -verbose -auth $auth -nolisten tcp vt7
diff --git a/etc/ConsoleKit/displays.d/usbseat.display b/etc/ConsoleKit/displays.d/usbseat.display
new file mode 100644
index 0000000..50eb60d
--- /dev/null
+++ b/etc/ConsoleKit/displays.d/usbseat.display
@@ -0,0 +1,5 @@
+[Display]
+Type=X11
+
+[X11]
+Exec=/usr/bin/X -config /tmp/xorg.conf.seat $display -br -audit 0 -verbose -auth $auth -nolisten tcp
diff --git a/etc/ConsoleKit/seats.d/01-seat1.seat b/etc/ConsoleKit/seats.d/01-usbseat.seat
index 3f8da0a..84966da 100644
--- a/etc/ConsoleKit/seats.d/01-seat1.seat
+++ b/etc/ConsoleKit/seats.d/01-usbseat.seat
@@ -8,4 +8,4 @@ Hidden=false
Devices=
-Sessions=Seat1;
+Sessions=seat1;
diff --git a/etc/ConsoleKit/seats.d/02-seat2.seat b/etc/ConsoleKit/seats.d/02-seat2.seat
deleted file mode 100644
index f444f6d..0000000
--- a/etc/ConsoleKit/seats.d/02-seat2.seat
+++ /dev/null
@@ -1,11 +0,0 @@
-[Seat Entry]
-Version=1.0
-Name=Secondary seat
-ID=Seat2
-Description=Seat 2
-
-Hidden=false
-
-Devices=
-
-Sessions=Seat2;
diff --git a/etc/ConsoleKit/sessions.d/Seat2.session b/etc/ConsoleKit/sessions.d/Seat2.session
deleted file mode 100644
index 8f19044..0000000
--- a/etc/ConsoleKit/sessions.d/Seat2.session
+++ /dev/null
@@ -1,8 +0,0 @@
-[Session Entry]
-Name=Local
-Type=LoginWindow
-Description=Local Login Screen
-DisplayTemplate=Seat2
-
-[Local]
-display=:1
diff --git a/etc/ConsoleKit/sessions.d/Seat1.session b/etc/ConsoleKit/sessions.d/usbseat.session
index 0f2e560..7b88ccb 100644
--- a/etc/ConsoleKit/sessions.d/Seat1.session
+++ b/etc/ConsoleKit/sessions.d/usbseat.session
@@ -6,3 +6,4 @@ DisplayTemplate=Seat1
[Local]
display=:0
+config_file=/etc/X11/xorg.conf.seat1
diff --git a/etc/X11/xorg.conf.seat1 b/etc/X11/xorg.conf.seat1
deleted file mode 100644
index 6255aee..0000000
--- a/etc/X11/xorg.conf.seat1
+++ /dev/null
@@ -1,58 +0,0 @@
-Section "ServerFlags"
- Option "AutoEnableDevices" "false"
- Option "AutoAddDevices" "false"
- Option "DefaultLayout" "seat"
- Option "DontZoom" "true"
- Option "DontZap" "true"
- Option "AllowMouseOpenFail" "yes"
-EndSection
-
-Section "Module"
- Load "ddc"
-EndSection
-
-Section "Files"
- ModulePath "/opt/xorg/lib/xorg/modules"
-EndSection
-
-Section "Device"
- Identifier "dl"
- driver "displaylink"
- Option "fbdev" "/dev/usbseat/seat1/display"
-EndSection
-
-Section "InputDevice"
- Identifier "keyboard"
- Driver "evdev"
- Option "CoreKeyboard"
- Option "Device" "/dev/usbseat/seat1/keyboard"
- Option "XkbModel" "evdev"
- Option "XkbLayout" "us"
-EndSection
-
-Section "InputDevice"
- Identifier "mouse"
- Driver "mouse"
- Option "CorePointer"
- Option "Protocol" "ImPS/2"
- Option "Device" "/dev/usbseat/seat1/mouse"
- Option "Buttons" "5"
- Option "ZAxisMapping" "4 5"
-EndSection
-
-Section "Monitor"
- Identifier "monitor"
-EndSection
-
-Section "Screen"
- Identifier "screen"
- Device "dl"
- Monitor "monitor"
-EndSection
-
-Section "ServerLayout"
- Identifier "seat1"
- Screen 0 "screen" 0 0
- InputDevice "keyboard" "CoreKeyboard"
- InputDevice "mouse" "CorePointer"
-EndSection
diff --git a/etc/X11/xorg.conf.seat2 b/etc/X11/xorg.conf.seat2
deleted file mode 100644
index 5958e6d..0000000
--- a/etc/X11/xorg.conf.seat2
+++ /dev/null
@@ -1,58 +0,0 @@
-Section "ServerFlags"
- Option "AutoEnableDevices" "false"
- Option "AutoAddDevices" "false"
- Option "DefaultLayout" "seat"
- Option "DontZoom" "true"
- Option "DontZap" "true"
- Option "AllowMouseOpenFail" "yes"
-EndSection
-
-Section "Module"
- Load "ddc"
-EndSection
-
-Section "Files"
- ModulePath "/opt/xorg/lib/xorg/modules"
-EndSection
-
-Section "Device"
- Identifier "dl"
- driver "displaylink"
- Option "fbdev" "/dev/usbseat/seat2/display"
-EndSection
-
-Section "InputDevice"
- Identifier "keyboard"
- Driver "evdev"
- Option "CoreKeyboard"
- Option "Device" "/dev/usbseat/seat2/keyboard"
- Option "XkbModel" "evdev"
- Option "XkbLayout" "us"
-EndSection
-
-Section "InputDevice"
- Identifier "mouse"
- Driver "mouse"
- Option "CorePointer"
- Option "Protocol" "ImPS/2"
- Option "Device" "/dev/usbseat/seat2/mouse"
- Option "Buttons" "5"
- Option "ZAxisMapping" "4 5"
-EndSection
-
-Section "Monitor"
- Identifier "monitor"
-EndSection
-
-Section "Screen"
- Identifier "screen"
- Device "dl"
- Monitor "monitor"
-EndSection
-
-Section "ServerLayout"
- Identifier "seat2"
- Screen 0 "screen" 0 0
- InputDevice "keyboard" "CoreKeyboard"
- InputDevice "mouse" "CorePointer"
-EndSection
diff --git a/etc/X11/xorg.conf.usbseat b/etc/X11/xorg.conf.usbseat
new file mode 100644
index 0000000..e3dd78d
--- /dev/null
+++ b/etc/X11/xorg.conf.usbseat
@@ -0,0 +1,59 @@
+Section "ServerFlags"
+ Option "AutoEnableDevices" "false"
+ Option "AutoAddDevices" "false"
+ Option "DefaultLayout" "seat"
+ Option "DontZoom" "true"
+ Option "DontZap" "true"
+ Option "AllowMouseOpenFail" "yes"
+EndSection
+
+Section "Module"
+ Load "ddc"
+EndSection
+
+Section "Files"
+ ModulePath "/usr/lib/xorg/modules"
+ ModulePath "/usr/local/lib/xorg/modules"
+EndSection
+
+Section "Device"
+ Identifier "dl"
+ driver "displaylink"
+ Option "fbdev" "/dev/usbseat/%ID_SEAT%/display"
+EndSection
+
+Section "InputDevice"
+ Identifier "keyboard"
+ Driver "evdev"
+ Option "CoreKeyboard"
+ Option "Device" "/dev/usbseat/%ID_SEAT%/keyboard"
+ Option "XkbModel" "evdev"
+ Option "XkbLayout" "us"
+EndSection
+
+Section "InputDevice"
+ Identifier "mouse"
+ Driver "mouse"
+ Option "CorePointer"
+ Option "Protocol" "ImPS/2"
+ Option "Device" "/dev/usbseat/%ID_SEAT%/mouse"
+ Option "Buttons" "5"
+ Option "ZAxisMapping" "4 5"
+EndSection
+
+Section "Monitor"
+ Identifier "monitor"
+EndSection
+
+Section "Screen"
+ Identifier "screen"
+ Device "dl"
+ Monitor "monitor"
+EndSection
+
+Section "ServerLayout"
+ Identifier "seat"
+ Screen 0 "screen" 0 0
+ InputDevice "keyboard" "CoreKeyboard"
+ InputDevice "mouse" "CorePointer"
+EndSection
diff --git a/src/usbseat.sh b/src/usbseat.sh
new file mode 100755
index 0000000..80e3b5c
--- /dev/null
+++ b/src/usbseat.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+# Lucas Ferreira
+# Takes the "seat name" as parameter $1
+
+SEAT_NAME=$1
+CK_LIST_SESSION="/usr/bin/ck-list-sessions"
+CK_SEAT_TOOL="/usr/sbin/ck-seat-tool"
+XORG_CONF_USBSEAT="/etc/X11/xorg.conf.usbseat"
+SESSION_TYPE="usbseat"
+DISPLAY_TYPE="usbseat"
+
+if [[ ! -n `/bin/pidof gdm-binary` ]]; then
+
+ exit 0
+fi
+
+SEAT_RUNNING=`ck-list-sessions | grep "seat = '${SEAT_NAME}'"`
+
+# $ACTION environment variable is set by udev subsystem
+case "$ACTION" in
+
+ 'remove')
+
+ if [[ -n "{$seat_running}" ]]; then
+
+ SEAT_NUMBER=${SEAT_NAME#seat}
+ $CK_SEAT_TOOL -d --sesion-id Session${SEAT_NUMBER}
+ fi
+ ;;
+
+ *)
+ # A device which might be part of a seat has been added
+ # if we already have a running seat for this #, exit
+ if [[ -n "$SEAT_RUNNING" ]]; then
+
+ exit 0
+ fi
+
+ if [[ -e /dev/usbseat/$SEAT_NAME/keyboard && \
+ -e /dev/usbseat/$SEAT_NAME/mouse && \
+ -e /dev/usbseat/$SEAT_NAME/display ]]; then
+
+ # We have a newly complete seat. Start it.
+ sed "s/%ID_SEAT%/$SEAT_NAME/g" < $XORG_CONF_USBSEAT \
+ > /tmp/xorg.conf.seat
+
+ $CK_SEAT_TOOL -a --session-type $SESSION_TYPE --display-type $DISPLAY_TYPE \
+ --seat-id $SEAT_NAME
+ fi
+ ;;
+esac
+
+exit 0
diff --git a/udev/50-usbseat.rules b/udev/50-usbseat.rules
index 39cd796..e2663e5 100644
--- a/udev/50-usbseat.rules
+++ b/udev/50-usbseat.rules
@@ -3,20 +3,20 @@
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="/usr/sbin/seat-id %b", SYMLINK+="usbseat/%c/display",RUN+="usbseat.sh %c"
+KERNEL=="fb*",SUBSYSTEMS=="usb", PROGRAM="/usr/sbin/seat-id %b", SYMLINK+="usbseat/%c/display",RUN+="/usr/sbin/usbseat.sh %c"
KERNEL=="mouse*", SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", \
-PROGRAM="/usr/sbin/seat-id %b", SYMLINK+="usbseat/%c/mouse", RUN+="usbseat.sh %c"
+PROGRAM="/usr/sbin/seat-id %b", SYMLINK+="usbseat/%c/mouse", RUN+="/usr/sbin/usbseat.sh %c"
KERNEL=="event*", SUBSYSTEM=="input", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", \
-PROGRAM="/usr/sbin/seat-id %b", SYMLINK+="usbseat/%c/keyboard", RUN+="usbseat.sh %c"
+PROGRAM="/usr/sbin/seat-id %b", SYMLINK+="usbseat/%c/keyboard", RUN+="/usr/sbin/usbseat.sh %c"
KERNEL=="control*", SUBSYSTEM=="sound", SUBSYSTEMS=="usb", PROGRAM="/usr/sbin/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="/usr/sbin/seat-id %b",SYMLINK+="usbseat/%c/keyboard",RUN+="usbseat.sh %c"
+PROGRAM="/usr/sbin/seat-id %b",SYMLINK+="usbseat/%c/keyboard",RUN+="/usr/sbin/usbseat.sh %c"
KERNEL=="mouse*", SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", \
-PROGRAM="/usr/sbin/seat-id %b",SYMLINK+="usbseat/%c/mouse",RUN+="usbseat.sh %c"
+PROGRAM="/usr/sbin/seat-id %b",SYMLINK+="usbseat/%c/mouse",RUN+="/usr/sbin/usbseat.sh %c"