Just a couple of silly mistakes on my part. Below are the reasons for no output
a) udev does not produce output to any sort of terminal/notification. I found it here!
- 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.
b) 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
- 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
PS: aA lot of people are facing trouble while using udev. Here is some help to go through the problems.:
udevinfoudevinfo and related tools have been replaced by udevadmudevadm. 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 heirarchical details of devices
:
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: This linkhttp://www.jpichon.net/blog/2011/12/debugging-udev-rules/ also proved very helpful