From 2eed2d021eaef496db87fab5856589d21daeee0d Mon Sep 17 00:00:00 2001 From: Thiago Abdo <tja14@inf.ufpr.br> Date: Wed, 13 Dec 2017 10:56:05 -0200 Subject: [PATCH] SCRUM#336: Nomea seats dinamicamente pela porta conectada Signed-off-by: Thiago Abdo <tja14@inf.ufpr.br> --- etc/udev/rules.d/73-seat-attach-assistant.rules | 2 +- usr/local/bin/seat-attach-assistant | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/etc/udev/rules.d/73-seat-attach-assistant.rules b/etc/udev/rules.d/73-seat-attach-assistant.rules index 719ccfd..f12ff48 100644 --- a/etc/udev/rules.d/73-seat-attach-assistant.rules +++ b/etc/udev/rules.d/73-seat-attach-assistant.rules @@ -1,5 +1,5 @@ ACTION=="remove", GOTO="seat_end" -SUBSYSTEM=="usb", TAG=="master-of-seat", ENV{ID_SEAT}=="", RUN+="/usr/local/bin/seat-attach-assistant %p" +SUBSYSTEM=="usb", TAG=="master-of-seat", ENV{ID_SEAT}=="", RUN+="/usr/local/bin/seat-attach-assistant $devpath $env{ID_PATH_TAG}" LABEL="seat_end" diff --git a/usr/local/bin/seat-attach-assistant b/usr/local/bin/seat-attach-assistant index 9bcbc77..2b31979 100755 --- a/usr/local/bin/seat-attach-assistant +++ b/usr/local/bin/seat-attach-assistant @@ -1,10 +1,9 @@ #!/bin/sh -case "${1}" in - *1) seat_id=seat-V0 ;; - *2) seat_id=seat-L0 ;; - *3) [ $(lspci | grep -c "Silicon.Motion") -gt 1 ] && seat_id=seat-V1 ;; - *4) [ $(lspci | grep -c "Silicon.Motion") -gt 1 ] && seat_id=seat-L1 ;; -esac +#Add some sanity tests +#keep log somewhere -[ -n "${seat_id}" ] && loginctl attach ${seat_id} /sys/${1} +devpath=$1 +seat_id=seat-$2 + +loginctl attach ${seat_id} /sys/${devpath} -- GitLab