Re: Getting Information from Multiple nodes
Thanks Anish .. I got your point . I was using struct inode *inode = file-f_dentry-d_inode; min = iminor(inode); to see which node has been opened, I wanted to make sure myself the correct/best way of getting this information. Praveen On Wed, Nov 16, 2011 at 8:02 PM, anish kumar anish198519851...@gmail.comwrote: On Wed, 2011-11-16 at 18:00 +0530, Praveen kumar wrote: Hi All, I have a I2C chip driver,and there are two identical chips on two different i2c bus. I have registered the driver and initialized it and created two nodes /dev/chip_0 and /dev/chip_1 If I open the node from user how will I make driver identify which device to access .ie in the ioctl. So in your ioctl call you want to get the device structure right? If yes then have a look at scull/main.c file in scull folder at below location. git://github.com/martinezjavier/ldd3.git Basically you need to set private_data of filp at open time with device information and get the private_data from filp in ioctl. If you don't understand then just have a look at the file I mentioned. Am I clear ??? Praveen ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Getting Information from Multiple nodes
Hi All, I have a I2C chip driver,and there are two identical chips on two different i2c bus. I have registered the driver and initialized it and created two nodes /dev/chip_0 and /dev/chip_1 If I open the node from user how will I make driver identify which device to access .ie in the ioctl. Am I clear ??? Praveen ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Getting Information from Multiple nodes
On Wed, 2011-11-16 at 18:00 +0530, Praveen kumar wrote: Hi All, I have a I2C chip driver,and there are two identical chips on two different i2c bus. I have registered the driver and initialized it and created two nodes /dev/chip_0 and /dev/chip_1 If I open the node from user how will I make driver identify which device to access .ie in the ioctl. So in your ioctl call you want to get the device structure right? If yes then have a look at scull/main.c file in scull folder at below location. git://github.com/martinezjavier/ldd3.git Basically you need to set private_data of filp at open time with device information and get the private_data from filp in ioctl. If you don't understand then just have a look at the file I mentioned. Am I clear ??? Praveen ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies