How to create a device in /dev automatically
- Include the header file linux/device.h and linux/kdev_t.h static struct class c_dev; static struct dev_t dev; - Add the below API 's inside __init fuction of the driver cl = class_create(THIS_MODULE ,"x"); where x - Name to be displayed inside /sys/class/ when driver is loaded. - Use device_create () kernel api with device_create(cl, NULL, dev, NULL, "d"); where d - device file to be created under /dev. - Use cdev_init to initialize - Use cdev_add to add the device to the /dev list
– What does “cat sys/bus/msm_subsys/devices/subsys2/state” mean ?
It means that asking the type of bus.
The Basic Device Driver-Model Structures
Dynamic Kernel Device Management with
How to create an event# device for a virtual input device (/dev/input/js3) in linux kernel module?
Linux Driver Tutorial: How to Write a Simple Linux Device Driver