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

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!

  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.

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

  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

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 --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: This linkhttp://www.jpichon.net/blog/2011/12/debugging-udev-rules/ also proved very helpful

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 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

PS: 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 heirarchical details of devices
This link also proved very helpful

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/

Post Migrated Here from stackoverflow.com (revisions)
Source Link
Hamzahfrq
  • 232
  • 1
  • 2
  • 7

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 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

PS: 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 heirarchical details of devices
This link also proved very helpful