Re: Application using i2c-imx.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi people,

Thank you very much for your reply Jean.
I patched the kernel tree with the patch you linked me to and then selected the hwmon and lm73 option in the menuconfig options (together with the i2c of course).

After that I used a cross-compiler to compile the kernel for my board and transferred the images to my board and started my linux there.

I assume the system supports i2c now.
No i2c devices appear in the /dev directory or in /sys/bus/i2c/devices, but the lm73 appears in /sys/bus/i2c/drivers and i2c appears in the file /proc/devices:

cat /proc/devices
Character devices:
... 
89 i2c
...

So now, how can I write an application in the user space that reads the temperature from the lm73? Do I have to use IOCTL calls or how do I do it?

Thanks again for your help and excuse my ignorance.
Regards,
Javier

2009/12/9 Jean Delvare <khali@xxxxxxxxxxxx>
Hi Javier,

On Tue, 8 Dec 2009 12:28:07 +0100, Javier Zugasti wrote:
> I wanted to ask if someone has used the i2c-imx driver functionalities to
> communicate with a LM sensor. I haven't found a single example in the web
> and I am very inexperienced with Linux.

You don't really have to care. Almost all I2C-based hwmon drivers
should work on top of any I2C bus driver. Exceptions are very rare (and
would suggest broken hardware design.)

> If so, could you please let me have a look to the application code so that I
> can understand how to communicate with my LM73 using the functions from the
> mentioned driver?

You don't have to do anything, drivers for this already exist. The lm73
driver isn't upstream yet, but it will be in a few days. For now you
can pick the patch from there:

ftp://ftp.kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-hwmon/hwmon-lm73-new-driver.patch

After patching your kernel tree, simply load the i2c-imx and lm73
drivers. Then either declare the lm73 device as part of your platform
data, or instantiate it from user-space using
the /sys/bus/i2c/devices/i2c-<n>/new_device file, where <n> is to be
replaced with the relevant i2c-imx's bus number (probably 0, if you
have a single I2C bus on your system.) And you should be done.

--
Jean Delvare
http://khali.linux-fr.org/wishlist.html

_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux