On Mon, 25 Mar 2024, Johnathan Mantey wrote:

My initial reaction would be to look at creating UDEV rules for those
devices.

Reading several udev-related web pages I created two shell scripts installed
in /usr/local/bin and rule 80-test.rules in /run/udev/rules.d

----- device_added.sh -----
#!/usr/bin/bash

echo "USB device added at $(date)" >>/tmp/udev.log
------

----- device_removed.sh -----
#!/usr/bin/bash

echo "USB device removed  at $(date)" >>/tmp/udev.log
------

----- 80-test.rules -----
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device",  
RUN+="/bin/device_added.sh"
SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", 
RUN+="/bin/device_removed.sh"
------

Inserting a USB pen drive no /tmp/scripts.log was created. I touched that
filename and reran `udevadm control --reload' but /tmp/scripts.log was
empty. As root, directly running the two device files in /usr/local/bin
added the proper content.

But, inserting and removing a USB pen drive does not add new lines to
/tmp/udev.log.

Advice needed.

Rich

Reply via email to