2003-06-04 19:05:00

by John Appleby

[permalink] [raw]
Subject: Serio keyboard issues 2.5.70

Hi,

I'm trying to write a keyboard driver using serio/input on 2.5.70; more
of a port of the existing 2.4 driver actually, but whatever.

I'm calling serio_register_device thus:

static struct serio_dev arckbd_dev = {
.interrupt = arckbd_interrupt,
.connect = arckbd_connect,
.disconnect = arckbd_disconnect
};

static int __init arckbd_init(void)
{
printk("input: Registering keyboard with serio\n");
serio_register_device(&arckbd_dev);
return 0;
}

And that printk is coming up fine. serio_register_device seems to add
0x021c2af8 to its tail, but then never finds my entry in
list_for_each_entry and thus never calls dev->connect(). I've added some
debugging to serio_register_device thus:

void serio_register_device(struct serio_dev *dev)
{
struct serio *serio;
list_add_tail(&dev->node, &serio_dev_list);
printk("serio: add_tail %08x\n",&dev->node);
list_for_each_entry(serio, &serio_list, node) {
printk("serio: register_device %08x\n",serio->dev);
if (!serio->dev && dev->connect) {
printk("serio: connecting...\n");
dev->connect(serio, dev);
}
}
}

and I get nothing past "add_tail". I'd expect it to recognize my dev and
attempt to connect to it.

Any ideas? I presume I'm being an idiot as per usual.

Thanks,

John



2003-06-04 19:37:40

by Perez-Gonzalez, Inaky

[permalink] [raw]
Subject: RE: Serio keyboard issues 2.5.70


> void serio_register_device(struct serio_dev *dev)
> {
> struct serio *serio;
> list_add_tail(&dev->node, &serio_dev_list);
> printk("serio: add_tail %08x\n",&dev->node);
> list_for_each_entry(serio, &serio_list, node) {
> printk("serio: register_device %08x\n",serio->dev);
> if (!serio->dev && dev->connect) {
> printk("serio: connecting...\n");
> dev->connect(serio, dev);
> }
> }
> }

Well - I don't know the real reason, but the code is
adding the device to the 'serio_dev_list', and the
list iteration is going over the 'serio_list'...


I?aky P?rez-Gonz?lez -- Not speaking for Intel -- all opinions are my own
(and my fault)

2003-06-04 19:50:45

by John Appleby

[permalink] [raw]
Subject: RE: Serio keyboard issues 2.5.70

> > void serio_register_device(struct serio_dev *dev)
> > {
> > struct serio *serio;
> > list_add_tail(&dev->node, &serio_dev_list);
> > printk("serio: add_tail %08x\n",&dev->node);
> > list_for_each_entry(serio, &serio_list, node) {
> > printk("serio: register_device %08x\n",serio->dev);
> > if (!serio->dev && dev->connect) {
> > printk("serio: connecting...\n");
> > dev->connect(serio, dev);
> > }
> > }
> > }
>
> Well - I don't know the real reason, but the code is
> adding the device to the 'serio_dev_list', and the
> list iteration is going over the 'serio_list'...

Yeah, I think that's correct though. At least I've traced it for PS2
keyboards and it finds its way into it.

Regards,

John


2003-06-04 22:09:55

by Russell King

[permalink] [raw]
Subject: Re: Serio keyboard issues 2.5.70

On Wed, Jun 04, 2003 at 08:23:21PM +0100, John Appleby wrote:
> And that printk is coming up fine. serio_register_device seems to add
> 0x021c2af8 to its tail, but then never finds my entry in
> list_for_each_entry and thus never calls dev->connect(). I've added some
> debugging to serio_register_device thus:
>
> void serio_register_device(struct serio_dev *dev)
> {
> struct serio *serio;
> list_add_tail(&dev->node, &serio_dev_list);
> printk("serio: add_tail %08x\n",&dev->node);
> list_for_each_entry(serio, &serio_list, node) {
> printk("serio: register_device %08x\n",serio->dev);
> if (!serio->dev && dev->connect) {
> printk("serio: connecting...\n");
> dev->connect(serio, dev);
> }
> }
> }
>
> and I get nothing past "add_tail". I'd expect it to recognize my dev and
> attempt to connect to it.

Do you drop out the bottom of the function? If you have no hardware ports
registered, I'd expect this to be the case.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2003-06-04 22:26:03

by John Appleby

[permalink] [raw]
Subject: RE: Serio keyboard issues 2.5.70


> > and I get nothing past "add_tail". I'd expect it to recognize my dev
and
> > attempt to connect to it.
>
> Do you drop out the bottom of the function? If you have no hardware
ports
> registered, I'd expect this to be the case.

Yeah; I thought though what I was doing was registering the port.

I'm clearly missing something really obvious here. Are you saying that I
should have registered the port somewhere else?

Sorry for the dumb questions but there's no serio documentation yet hit
the tree, I presume as it's pretty new for non-USB devices.

Regards,

John


2003-06-04 22:34:07

by Russell King

[permalink] [raw]
Subject: Re: Serio keyboard issues 2.5.70

On Wed, Jun 04, 2003 at 11:44:17PM +0100, John Appleby wrote:
>
> > > and I get nothing past "add_tail". I'd expect it to recognize my dev
> and
> > > attempt to connect to it.
> >
> > Do you drop out the bottom of the function? If you have no hardware
> ports
> > registered, I'd expect this to be the case.
>
> Yeah; I thought though what I was doing was registering the port.
>
> I'm clearly missing something really obvious here. Are you saying that I
> should have registered the port somewhere else?
>
> Sorry for the dumb questions but there's no serio documentation yet hit
> the tree, I presume as it's pretty new for non-USB devices.

You need to register:

- serio device drivers (the things which drive the hardware) using
serio_register_port()
- serio protocol drivers (the things which interpret the bytes,
like atkbd.c) using serio_register_device()

So, for a PS/2 keyboard connected to a some special hardware interface,
you'd use atkbd.c which registers itself with serio using
serio_register_device(). Your device driver for the "special hardware"
registers itself with serio_register_port().

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2003-06-04 22:46:20

by Perez-Gonzalez, Inaky

[permalink] [raw]
Subject: RE: Serio keyboard issues 2.5.70

> From: Russell King [mailto:[email protected]]
>
> - serio device drivers (the things which drive the hardware) using
> serio_register_port()
> - serio protocol drivers (the things which interpret the bytes,
> like atkbd.c) using serio_register_device()

Kind of counter-intuitive :] I guess renaming to something
that is more obvious is out of the question at this page of
the book, right? Not that it is a big deal, though...

I?aky P?rez-Gonz?lez -- Not speaking for Intel -- all opinions are my own
(and my fault)

2003-06-04 22:50:15

by Russell King

[permalink] [raw]
Subject: Re: Serio keyboard issues 2.5.70

On Wed, Jun 04, 2003 at 03:59:44PM -0700, Perez-Gonzalez, Inaky wrote:
> Kind of counter-intuitive :] I guess renaming to something
> that is more obvious is out of the question at this page of
> the book, right? Not that it is a big deal, though...

I believe so on both points; however, the final decision would need
to be made by Vojtech.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html