Shakthi Kannan <[EMAIL PROTECTED]> 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



_______________________________________________
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd

Reply via email to