open() returns 0.

Josh Boyer jwboyer at jdub.homelinux.org
Wed Aug 10 03:19:43 EST 2005


> Hello All,
>
>   I have a 8270 based board running Linux 2.6.  I am using the i2c
> available on chip to read / write a i2c mux connected to it.  When I
> open the i2c device, it returns 0 (which shouldnt be) instead of the
> file descriptor.   The /proc/devices shows the i2c driver with major
> 89 is installed.

Does your program close all it's file descriptors before opening the i2c
device?  0 is a valid file descriptor.  It's just normally used by STDIN. 
If a program closes or doesn't inherit STDIN for some reason, 0 becomes
available.

josh




More information about the Linuxppc-embedded mailing list