Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need for /dev nodes at the time of accessing Linux Drivers

I am trying to understand the necessity of /dev node in Linux 2.6 . I do understand that, in Linux 2.4 days, entries under this directory were necessary so as to access the Drivers from userspace. But in 2.6 version we use /sys interface inorder to achieve this. But still could find entries for within /dev directory .

As a step towards understanding the same, I changed the name parameter (this was the name in my /dev directory ) , within "miscdevice" object, that was passed as input to "misc_register" API within my Sensor driver and still the driver worked the same way.

Are there any drivers which still relay on /dev node for their working ? If yes what are they ?

Thanks, Venkatesh.

like image 547
user1227554 Avatar asked Dec 19 '25 18:12

user1227554


1 Answers

You are confusing two different things...

The files in /dev are the actual devices that you read and write to in order to interact with a device - so if you want to write to a serial port you open the file in /dev that represents it and write to it.

The files in /sys expose various attributes of the device to userspace so that programs can, for example, see what features a device supports, or hos it is configured. In a few cases the files in /sys can be written to in order to change the configuration of the device in some way.

like image 109
TomH Avatar answered Dec 22 '25 10:12

TomH



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!