LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 07-01-2004, 01:16 PM   #1
Mike Davies
Member
 
Registered: Jul 2004
Distribution: Custom Linux, Buildroot, Busybox, Fedora, Raspberry Pi
Posts: 106

Rep: Reputation: 15
Got i2c working ? You can answer this for me.


I'm trying to get an i2c interface going, and I'm not quite sure where my problems lie. Suffice to say, it doesn't work.

I have built an Philips style adaptor. I'm running with a 2.4.20 kernel. The software modules appear to load OK, and I have this in /proc

# ls -l /proc/bus
-r--r--r-- 1 root root 0 Jun 29 18:18 i2c
-r--r--r-- 1 root root 0 Jun 29 18:18 i2c-0
dr-xr-xr-x 3 root root 0 Jun 29 18:18 isapnp
# cat /proc/bus/i2c
i2c-0 i2c Philips Parallel port adapter Bit-shift algorithm
# cat /proc/bus/i2c-0
cat: read: Invalid argument
#

What I don't understand is this problem with /proc/bus/i2c-0.

Am I right in thinking that this file should contain the addresses of all the devices on the i2c-0 bus ? and I should be able to read the file shouldn't I ?

Ignoring that problem for a moment - if I try to set the slave address with something like

if( ( r = ioctl(fd, I2C_SLAVE, addr)) < 0)
{
fprintf(stderr, "Error eeprom_open: %s\n", strerror(errno));
return -1;
}

then it errors out. This code snippet is from 'eeprog' which is a simple program to access 24Cxx EEPROM devices available at codesink.org/eeprog.html so I guess should work OK. I assume it fails because it can't read the file /proc/bus/i2c-0

So the problem is either with the adaptor I have built (and it's not detecting my chips correctly) or the way the modules have loaded.

If I disconnect my adaptor, then I still get problems typing the contents of /proc/bus/i2c-0 as above.

Can someone with i2c working please confirm that I should be able to type out the contents of /proc/bus/i2c-0 and that it contains addresses of devices on the i2c bus.

If not, what does it contain if anything ?
 
Old 07-03-2004, 04:12 AM   #2
Mike Davies
Member
 
Registered: Jul 2004
Distribution: Custom Linux, Buildroot, Busybox, Fedora, Raspberry Pi
Posts: 106

Original Poster
Rep: Reputation: 15
I'll answer my own question here in case someone else comes across the problem.

Basically, it's a bug in the 2.4 kernel.

The bug is in module i2c-core.c and a patch is available. I found it by using Google and searching for "cat: read: Invalid argument"

I hope this helps someone in the future.
 
Old 07-03-2004, 01:30 PM   #3
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 85
Mike - congratulations on solving the problem, and thanks also for describing how you solved it. I am certain that your posts will be helpful to future visitors who may encounter the same issue.

Also, Welcome to LQ! -- J.W.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! Problems with i2c-dev. No more /dev/i2c-* em1l Fedora 0 10-28-2005 05:48 AM
How do I get this i2c temperature monitoring thing working? Mr. Asdf Linux - Hardware 4 08-12-2005 06:46 AM
What am I do do? What am I2C? Titan2k SUSE / openSUSE 2 07-12-2005 07:15 PM
ADSL is working, but answer from pppoeconf markraem Linux - Networking 0 08-26-2004 03:24 PM
Are you dual booting and Windows stopped working (booting) then here's the answer: rberry88 Linux - General 1 02-12-2004 09:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 04:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration