From 315598f5ad054f9b892bbc8aa95d4832370bce58 Mon Sep 17 00:00:00 2001 From: Mohammad_Faraji Date: Wed, 22 May 2024 20:23:37 +0330 Subject: [PATCH] Refactor usb-storage-rules for checking add and remove --- src/rules/90-usb-storage.rules | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rules/90-usb-storage.rules b/src/rules/90-usb-storage.rules index a86bab5..9bbf420 100644 --- a/src/rules/90-usb-storage.rules +++ b/src/rules/90-usb-storage.rules @@ -1 +1,4 @@ -ACTION=="add", SUBSYSTEM=="block", ENV{ID_BUS}=="usb", ENV{ID_FS_USAGE}=="filesystem", RUN+="/usr/bin/sudo /usr/local/bin/usb-storage-action %E{DEVNAME}" \ No newline at end of file +# Rule for USB device connection +ACTION=="add", SUBSYSTEM=="block", ENV{ID_BUS}=="usb", ENV{ID_FS_USAGE}=="filesystem", RUN+="/usr/bin/sudo /usr/local/bin/usb-storage-action add %E{DEVNAME}" +# Rule for USB device disconnection +ACTION=="remove", SUBSYSTEM=="block", ENV{ID_BUS}=="usb", ENV{ID_FS_USAGE}=="filesystem", RUN+="/usr/bin/sudo /usr/local/bin/usb-storage-action remove %E{DEVNAME}"