Just a couple of silly mistakes on my part. Below are the reasons for no output
- 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.
- 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 usingRUN=. 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 --udevto view udev activity upon adding/removing hardware in real timelsusbto see attached usb devicesudevadm info --attribute-walk --name /dev/sdc?to view hierarchical details of devices
Source: http://www.jpichon.net/blog/2011/12/debugging-udev-rules/