Questions tagged [udev]

Udev manages the Linux /dev directory, and hooks userspace into kernel device events.

udev (userspace /dev) is a device manager for the Linux kernel. As the successor of devfsd and hotplug, udev primarily manages device nodes in the /dev directory. At the same time, udev also handles all user space events raised when hardware devices are added into the system or removed from it, including firmware loading as required by certain devices.

https://en.wikipedia.org/wiki/Udev

https://wiki.debian.org/udev

http://reactivated.net/writing_udev_rules.html

518 questions
4
votes
2 answers

Listen for harware change events from the linux kernel or udev

I need to run some code on storage device mounting and unmounting. How can i listen for these events on linux? I was thinking on adding some udev rules to run some script (any know-how in this matter is appreciated). But I would much rather…
clyfe
  • 23,695
  • 8
  • 85
  • 109
4
votes
3 answers

How to get USB Drive Label in Linux?

I am trying to get USB drive's Label in my c/c++ Application. I am using libudev to get the usb details. But it doesn't provides the drives Label. Does any one have an idea on how to get the drive Label. I am working on embedded platform, it…
jsaji
  • 900
  • 1
  • 15
  • 31
4
votes
1 answer

udev rule to create device node from character device listed in /proc/devices

I have a PCI device which I've been able to configure a DKMS module for. The kernel module is loaded and I see the device appear in /proc/devices. The driver had a load_driver.sh script which creates a device node using mknod. I want to make a udev…
bofjas
  • 1,186
  • 7
  • 19
4
votes
1 answer

Fedora 20 udev rule for hidraw not working

I have a Qt application running on Ubuntu (14.04) and Fedora (20) that needs to communicate with a USB HID device without root permissions (running the application as root works fine, so no problems there). On ubuntu, this works fine with following…
Mathieu
  • 41
  • 3
4
votes
2 answers

USB device detection on /dev directory on Linux

Using the lsusb command in Linux I have come to know about bus and device numbers, along with its name of newly attached USB devices. But how can I know on which device directory (/dev/*) USB device get attached in Linux using command lines only?
Manku
  • 431
  • 3
  • 9
  • 16
4
votes
1 answer

Get the form factor of a Linux machine

Is there a "usual" way to detect whether a is a laptop, desktop, tablet, phone, embedded device, server, virtual machine and so on without the use of HAL? In the past this information could be snagged from smbios.chassis.type, but as HAL is now…
Gareth Davidson
  • 4,857
  • 2
  • 26
  • 45
4
votes
1 answer

Triggering udev rule for particular keyboard

I need to write a udev rule for a particular keyboard which does not seem to have any unique attribute against which to match. The lines below are the output of udevadm monitor upon insertion of the device. Is there something here I could use to…
ealfonso
  • 6,622
  • 5
  • 39
  • 67
4
votes
2 answers

udev rule runs bash script multiple times

I created a udev rule to execute a bash script after the insertion of a usb device SUBSYSTEMS=="usb", ATTRS{serial}=="00000000", SYMLINK+="Kingston", RUN+="/bin/flashled.sh" However the script is run several times instead of just once, I assume it…
Lurch
  • 819
  • 3
  • 18
  • 30
4
votes
4 answers

How do dev files work?

How guys from linux make /dev files. You can write to them and immediately they're erased. I can imagine some program which constantly read some dev file: FILE *fp; char buffer[255]; int result; fp = fopen(fileName, "r"); if (!fp) { …
badeleux
  • 592
  • 5
  • 15
4
votes
0 answers

Trigger event on plug/unplug of HDMI monitor? What about for speakers?

I'm trying to execute a script whenever a monitor or speaker is plugged in or not. I am ideally looking for a solution that would cover both monitors and speakers (so not something display-specific like xrandr), would not involve polling, and would…
quantka
  • 920
  • 1
  • 10
  • 15
4
votes
1 answer

Replacement for hal-get-property and hal-find-by-capability in udev?

I need to port a bash script which uses deprecated HAL tools like hal-get-property or hal-find-by-capability to udev. HAL states that HAL was merged into udev, but I couldn't find useful informations on how to proper port this script to…
0x80
  • 176
  • 1
  • 6
4
votes
2 answers

Run something when USB device is plugged in doesn't work

I made a script in /etc/udev/rules.d/local.rules SUBSYSTEM=="usb", SYSFS{idVendor=="b58e"}, SYSFS{idProduct=="9e84"}, ACTION=="add", RUN+="notify-send USB" I then reload udev with sudo udevadm control --reload-rules I've tried to remove…
ForeverConfused
  • 1,607
  • 3
  • 26
  • 41
4
votes
1 answer

How can I get know when I plug my headphones into the 3.5 interface?

I want to write a small program in C: When I plug my headphones in my notebook, it should turn the volume lower. Then, when I remove headphone from my notebook, it should turn the volume back up. I am using the alsa driver, and I know how to control…
madper
  • 806
  • 1
  • 10
  • 25
4
votes
2 answers

passing parameters in udev rule

I've written 2 rules in udev for usb add and removed in 2 files. SUBSYSTEM=="usb", ACTION=="add", RUN+="/u/usb_added %b" SUBSYSTEM=="usb", ACTION=="remove", RUN+="/u/usb_remove %b" I have created two different scripts for these rules that take…
user115079
  • 711
  • 1
  • 11
  • 23
4
votes
1 answer

usb detail via udev

I have written a udev rule that call a script to send email when a usb drive is attached/removed. so far its working fine. but i want to know if there is any way i can include detail of usb drive in my email? how can i get it using udev? like usb…
user115079
  • 711
  • 1
  • 11
  • 23