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
> 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)
> > 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
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
> > 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
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
> 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)
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