[openbeos] Re: device driver question

En réponse à Bruno van Dooren <bruno_van_dooren@xxxxxxxxxxx>:

> Hi,
> 
> if i understand it correctly i have to perform a hardware check in
> init_hardware so that the system knows
> if it should load the driver. if there are devices, it loads the driver
> and calls publish_devices.
> 
> now assume that the mouse was not plugged in at boot time (no devices.
> init_hardware fails),
> i see this and i plug it in after boot time.
> how can i let the system know that it should try to init_hardware and
> load the driver?
> 
> i could manually remove the driver and drop it again in the /bin folder,
> but that is soooo ugly.
> there has to be some way to do this right?
> 
> kind regards,
>     Bruno

Depends if you talk about PS2 controller or the device plugged in it...

Anyway, 
1)
rescan kbmouse
is cleaner than moving your driver around.
(I think input_server does that when you restart it)

2)
Another thing you can do is publish a device anyway, and answer EIO 
or ENODEV until there is a real mouse plugged.

3)
Another possibility is to keep your driver loaded and have it 
self-rescanned if it gets an irq telling a mouse has been plugged.

I'd go for 2), as 3) is more complex for not much better, besides the 
PS/2 port isn't supposed to be plug-n-play (even if I do myself 
hotplug my mouse sometimes :)


François.

Other related posts: