On 26 March 2014 22:55, "Jóhann B. Guðmundsson" <johan...@gmail.com> wrote: > SUBSYSTEM=="input", ENV{ID_INPUT_KEYBOARD}=="?*", ENV{.INPUT_CLASS}="kbd", > TAG+="systemd", ENV{SYSTEMD_WANTS}+="shkd@%p.service"
Trying to teach myself how to fish here. How did you know it would match this particular device? $ udevadm monitor monitor will print the received events for: UDEV - the event which udev sends out after rule processing KERNEL - the kernel uevent KERNEL[290197.779159] remove /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/input/input7/event0 (input) KERNEL[290197.788432] remove /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/input/input7 (input) KERNEL[290197.791409] remove /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/0003:13BA:0001.0008/hidraw/hidraw0 (hidr aw) KERNEL[290197.799059] remove /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/0003:13BA:0001.0008 (hid) KERNEL[290197.799463] remove /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0 (usb) KERNEL[290197.799878] remove /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2 (usb) UDEV [290198.000420] remove /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/input/input7/event0 (input) UDEV [290198.019272] remove /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/0003:13BA:0001.0008/hidraw/hidraw0 (hidr aw) UDEV [290198.028247] remove /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/input/input7 (input) UDEV [290198.033868] remove /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/0003:13BA:0001.0008 (hid) UDEV [290198.051687] remove /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0 (usb) UDEV [290198.057794] remove /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2 (usb) KERNEL[290199.905920] add /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2 (usb) UDEV [290199.916744] add /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2 (usb) KERNEL[290199.918617] add /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0 (usb) KERNEL[290199.926306] add /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/0003:13BA:0001.0009 (hid) KERNEL[290199.926697] add /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/input/input8 (input) KERNEL[290199.934673] add /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/input/input8/event0 (input) KERNEL[290199.936852] add /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/0003:13BA:0001.0009/hidraw/hidraw0 (hidr aw) UDEV [290199.979780] add /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0 (usb) UDEV [290200.026897] add /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/0003:13BA:0001.0009 (hid) UDEV [290200.046996] add /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/0003:13BA:0001.0009/hidraw/hidraw0 (hidr aw) UDEV [290200.059797] add /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/input/input8 (input) UDEV [290200.121850] add /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2.2/1-1.2.2:1.0/input/input8/event0 (input) > /etc/systemd/system/shkd@.service > > [Unit] > Description=Simple HotKey Daemon > > [Service] > ExecStart=/usr/local/bin/shkd %I > Restart=always > > [Install] > WantedBy=multi-user.target So IIUC, just have the udev rule there will start the systemd service. No need to enable anything? Anyway, it doesn't seem to work. [hendry@alarmpi ~]$ systemctl | grep shk shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0-event0.service loaded failed failed Simple HotKey Daemon shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0.service loaded failed failed Simple HotKey Daemon system-shkd.slice loaded active active system-shkd.slice [hendry@alarmpi ~]$ sudo systemctl status shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0-event0.service shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0-event0.service - Simple HotKey Daemon Loaded: loaded (/etc/systemd/system/shkd@.service; disabled) Active: failed (Result: start-limit) since Thu 1970-01-01 07:30:16 SGT; 44 years 2 months ago Process: 200 ExecStart=/usr/local/bin/shkd %I (code=exited, status=1/FAILURE) Main PID: 200 (code=exited, status=1/FAILURE) Jan 01 07:30:16 alarmpi systemd[1]: Unit shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0-ev... state. Jan 01 07:30:16 alarmpi systemd[1]: shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0-event0....estart. Jan 01 07:30:16 alarmpi systemd[1]: Stopping Simple HotKey Daemon... Jan 01 07:30:16 alarmpi systemd[1]: Starting Simple HotKey Daemon... Jan 01 07:30:16 alarmpi systemd[1]: shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0-event0.... start. Jan 01 07:30:16 alarmpi systemd[1]: Failed to start Simple HotKey Daemon. Jan 01 07:30:16 alarmpi systemd[1]: Unit shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0-ev... state. Hint: Some lines were ellipsized, use -l to show in full. [hendry@alarmpi ~]$ sudo systemctl status shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0.service shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0.service - Simple HotKey Daemon Loaded: loaded (/etc/systemd/system/shkd@.service; disabled) Active: failed (Result: start-limit) since Thu 1970-01-01 07:30:16 SGT; 44 years 2 months ago Process: 199 ExecStart=/usr/local/bin/shkd %I (code=exited, status=1/FAILURE) Main PID: 199 (code=exited, status=1/FAILURE) Jan 01 07:30:16 alarmpi systemd[1]: shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0.service...FAILURE Jan 01 07:30:16 alarmpi systemd[1]: Unit shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0.se... state. Jan 01 07:30:16 alarmpi systemd[1]: shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0.service...estart. Jan 01 07:30:16 alarmpi systemd[1]: Stopping Simple HotKey Daemon... Jan 01 07:30:16 alarmpi systemd[1]: Starting Simple HotKey Daemon... Jan 01 07:30:16 alarmpi systemd[1]: shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0.service... start. Jan 01 07:30:16 alarmpi systemd[1]: Failed to start Simple HotKey Daemon. Jan 01 07:30:16 alarmpi systemd[1]: Unit shkd@-devices-platform-bcm2708_usb-usb1-1-1-1-1.2-1-1.2.2-1-1.2.2:1.0-input-input0.se... state. Hint: Some lines were ellipsized, use -l to show in full. Not sure what happened "/dev/input/by-id/usb-13ba_0001-event-kbd". What is a slice? Is there another forum for udev help? Many thanks, _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel