How to access i2c device driver node
I have an i2c chip driver as part of linux kernel. I can verify the i2c chip driver is in the kernel from kernel boot messages (my chip driver is mma8450)
mma8450 0-001c: uevent
I can also see this driver in (0x1c is i2c address of chip)
I can not see this driver node in /dev interface. My question is how can I create node of this device in /dev so that I can access this device in a user program ?
I create the module of the same chip driver and does not make it a part of kernel. I can load this module using insmod mma8450, how can I create a node of this device as I don't have its major / minor numbers ? (I can not see major & minor numbers assigned to this driver in mma8450 source code)
Any help is appreciated
the command to create nodes manually is "mknod"
To get to know the major number assigned to your module look in /proc/devices,after insmod.
The first column lists the major numbers and the second column the name with which the module was registered.
Thanks for the response. My /proc/devices lists the i2c bus driver
and I can see the node of this driver in /dev/ as /dev/i2c-0 /dev/i2c-1. I can verify both these nodes from
I have another i2c chip driver which is also appearing in /sys/bus/i2c/devices/0-001c. I can verify the device of this driver (& its the same device I am trying to access) from
I don't see any node for this device in /dev/
or perhaps I am asking the wrong question or doing it the wrong way. My problem is simple (i think so). I have a i2c accelerometer attached on i2c bus of my board. I can see the driver for this i2c chip in my linux system as I have mentioned above (/sys/bus/i2c/devices/0-001c/name). Now I want to access this chip through this driver, for which I believe in need a device node in /dev/ to open from a user space program, but I can't see the node !!
I was reading an article (http://www.linuxjournal.com/article/7252?page=0,0) that i2c chip drivers expose their parameter values (readable/writable) in sysfs (each exposed parameter will create a file in sysfs). My question, should such i2c chip driver will be accessed through sysfs and if yes then how. Wouldn't my user space program will be highly dependent on one particular driver implementation.
Any thought or help is appreciated.
Did you include/load the i2c-dev module?
Check your kernel config file, or try
"lsmod | grep i2c-dev"
This creates the /dev/ references for the i2c bus.
Search the kernel documentation for more information (have a look at this link)
When you do
Also, where did you find the driver? Are you trying to use this recently submitted patch http://www.spinics.net/lists/lm-sensors/msg32062.html ? I can't find any mma8450 driver in the latest kernel.
I am bit busy in other work so I haven't tried this so far. Will let you know when I do this.
Not sure about the patch you have mentioned but I found the driver from Freescale iMX53 Quick Start Board BSP for Linux provided by Freescale. http://www.freescale.com/webapp/sps/...sign_Tools_Tab
Go to "Board Support Packages" and download the file L2.6.35_11.03_ER_SOURCE. Apply patches and you will have your driver in kernel source.
I ma new to device driver,,,Board is up,,,and i wanted to check the i2c devices present in the board...
Please let me know how we do it?
|All times are GMT -5. The time now is 07:33 PM.|