linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* open() returns 0.
@ 2005-08-09 15:00 Jayaprakash Shanmugam
  2005-08-09 17:19 ` Josh Boyer
  0 siblings, 1 reply; 2+ messages in thread
From: Jayaprakash Shanmugam @ 2005-08-09 15:00 UTC (permalink / raw)
  To: linuxppc-embedded

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.

10:~# ls -l /dev/i2c-0
lrwxrwxrwx  1 root root 5 Jan  1 02:00 /dev/i2c-0 -> i2c/0

10:~# cat /dev/i2c-0
i2c-dev: i2c-0 reading 4096 bytes.
I2C xfer: read from 0xFFFF, flags 0x0001, 4096 bytes
I2C error: 0x3C04
cat: /dev/i2c-0: Input/output error

Any pointers on what could be wrong ?

Regards,
Jayaprakash.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: open() returns 0.
  2005-08-09 15:00 open() returns 0 Jayaprakash Shanmugam
@ 2005-08-09 17:19 ` Josh Boyer
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Boyer @ 2005-08-09 17:19 UTC (permalink / raw)
  To: Jayaprakash Shanmugam; +Cc: linuxppc-embedded

> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-09 17:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-09 15:00 open() returns 0 Jayaprakash Shanmugam
2005-08-09 17:19 ` Josh Boyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).