[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: user-space device drivers - hurd
From: |
Marco Gerards |
Subject: |
Re: user-space device drivers - hurd |
Date: |
Wed, 14 Sep 2005 18:03:50 +0200 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.3 (gnu/linux) |
Shakthi Kannan <shakstux@yahoo.com> writes:
Hi,
> But, I am looking for some basic (hello world?)
> example to understand how the device interfaces in GNU
> Hurd:
>
> http://www.gnu.org/software/hurd/gnumach-doc/mach_10.html#SEC89
>
> interact with its particular GNU mach driver
> probe/open/close/read/write function in gnumach.
>
> In GNU/Linux kernel, we register a driver with the
> kernel and use device major and minor numbers. I am a
> little lost with gnumach and gnu hurd.
Devices are opened from the Hurd by using device_open. The name of
the device is passed to this function. Somehow the kernel figures out
which driver is responsible for the device with a specific name.
For example (from console-client/pc-kbd.c):
err = device_open (device_master, D_READ, "kbd", &kbd_dev);
After that data can be read from this device:
error_t err = device_read_inband (kbd_dev, 0, -1, 1,
(void *) &next, &data_cnt);
So that is how devices are accessed from the Hurd. You could follow
the path from there. It ends at kbdread in i386/i386at/kd_event. So
you can also follow the path in reverse.
--
Marco