Skip to main content
2 of 2
Removed "PS"; fixed formatting and typo; changed "useful [link]" to source: <link> since the above list refers to that linked post

Just a couple of silly mistakes on my part. Below are the reasons for no output

  1. udev does not produce output to any sort of terminal/notification. I found it here!

udev does not run these programs on any active terminal, and it does not execute them under the context of a shell. Be sure to ensure your program is marked executable, if it is a shell script ensure it starts with an appropriate shebang (e.g. #!/bin/sh), and do not expect any standard output to appear on your terminal.

  1. for redirecting output to the file, I was using ~ instead of the whole path of the user's home directory. Changing it to absolute path did produce the output. For the record, I put my rule under 12-hf-usb.rules. The only problem I am facing is that the script is executed twice, even after using RUN=. I'll edit the answer once I find it. It looks like I have to make the rule more specific, to match only one device. It is not important for me at the moment so I will skip it

A lot of people are facing trouble while using udev. Here is some help to go through the problems:

udevinfo and related tools have been replaced by udevadm. Below are some useful commands:

  • udevadm monitor --udev to view udev activity upon adding/removing hardware in real time
  • lsusb to see attached usb devices
  • udevadm info --attribute-walk --name /dev/sdc? to view hierarchical details of devices

Source: http://www.jpichon.net/blog/2011/12/debugging-udev-rules/

Hamzahfrq
  • 232
  • 1
  • 2
  • 7