[i2c] Connecting i2c keyboard to bus

Mark M. Hoffman mhoffman at lightlink.com
Thu Oct 5 12:38:48 CEST 2006


Hi Corine:

Please continue to CC the i2c mailing list on all replies.

* Corine Liang <nici at starhub.net.sg> [2006-10-04 18:50:08 +1000]:
>       THANK YOU for replying!!!! Really need some help. Let me be a bit more 
> specific on what I know and you tell me whether what I am doing is correct or 
> utterly wrong.
> 
> PIC chip ---------------------------------------------------->Gumstix (Linux
> Kernel 2.6.11)
> 
> Before PIC and talk to Linux I need to write a:
> i2c chip driver, follow by a bus driver and a client driver????
> I suppose I also need to change the current keyboard module to point to i2c 
> bus??

You need an I2C chip driver for your (PIC) hardware, yes.

You probably don't need to write your own I2C bus driver... but you haven't
given me enough information to tell for sure.  See if you can use one of the
existing bus drivers with your gumstix hardware.

In the I2C subsystem, a "client" is the part of the chip driver which is bound
to a specific I2C address.

Keyboards are part of the 'input' subsystem in Linux.  You may need to look
elsewhere for help with that bit.

> Do I make sense at all to you? The truth is information are just scattered 
> everywhere and I just do not know how to start. Not that I want you to "spoon 
> feed" me but I just need some mentoring and guidance. 

Do you have an oscilloscope?  A good place to start is to get an I2C bus driver
working with your gumstix hardware.  If none of the existing drivers will work,
then you'll have to write one.

> I read an Journal on writing i2c drive @ 
> http://www.linuxjournal.com/article/7136
> 
> Is Greg trying to write a kernel code or a program?

All of that is kernel code.

> Really looking forward to your reply,
> Corine Liang
> 
> 
> On Tuesday 03 October 2006 20:23, you wrote:
> > Hi Corine:
> >
> > * Corine Liang <nici at starhub.net.sg> [2006-10-03 20:12:12 +1000]:
> > > Hi all,
> > >       I need help in connecting a USB keyboard to i2c bus and redirect
> > > Linux to take input from keyboard. This is what I did:
> > >
> > > Keyboard ------------> PIC16F84A-------------------> Linux
> > >
> > > PIC16F84A acts as a translator to convert keyboard signal to I2C signal.
> > > This part is done. The grey area for me is to connect it to Linux and
> > > Linux recognizing it. I read through many books (and website, of
> > > course)on connecting i2c devices to Linux but the problem is that I am
> > > not using a "conventional" Phillips i2c chip.  What should I do? Do I
> > > need to write a custom i2c chip driver for it? ANY suggestion would
> > > really help!!
> >
> > 1) You'll need an I2C bus driver on the Linux machine.  Without knowing
> > more about your system or requirements, I suggest you take a look at
> > i2c-parport.
> >
> > 2) Yes, you'll need to write an I2C "chip" driver for your custom hardware.
> > For prototyping or experimentation, you could use the i2c-dev interface:
> > that allows you to perform bus transfers from userspace (no kernel code
> > required). The lm-sensors project has several examples of how to do this. 
> > After you're satisfied that you can talk to your device, you can move that
> > code into an actual kernel driver.
> >
> > 3) Given your design... your chip driver should have a 'downward' interface
> > to the PIC over I2C, and an 'upward' interface to the Linux input
> > subsystem. This list probably can't help much with the latter, sorry.
> >
> > HTH.  If you get stuck, please try to ask more specific questions.
> >
> > Regards,
> 
> ----------------------------------------------------------
> This email has been scanned for viruses by StarHub e.Scan.

-- 
Mark M. Hoffman
mhoffman at lightlink.com




More information about the i2c mailing list