Here is a patch enable setting DC_RAW via a device_set_status on the
console device.  While doing this code, I found that devio.c in 
hurd/daemons calls this function with the TTY_* flavors, hence their
inclusion here.

No changelog yet, as I am not sure how done I am.  I'll continue 
working on that user-space console Marcus was talking about.

Invocation:
        mach_port_t master;
        kern_return_t err;
        mach_port_t console;
        
        err = get_privileged_ports(NULL, &master);
        if (err)
          return err;
        err = device_open(master, D_READ, "console", &console);
        if (err)
          return err;
        mach_port_deallocate(mach_task_self(), master);
        
        err = device_set_status(console, DC_RAW, 0, 0);
        if (err)
          return err;

        /* console stuff here */

        err = device_set_status(console, DC_NO_ONLCR, 0, 0);
        if (err)
          return err;

Thanks,
Kevin
-- 
Kevin Kreamer
FsckIt on openprojects.net
Index: oskit/ds_asyncio.c
===================================================================
RCS file: /cvsroot/hurd/gnumach/oskit/Attic/ds_asyncio.c,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 ds_asyncio.c
--- oskit/ds_asyncio.c  1999/11/25 23:26:46     1.1.2.1
+++ oskit/ds_asyncio.c  2001/10/18 16:35:51
@@ -377,6 +377,44 @@ ds_asyncio_write_inband (device_t dev, i
   return err ?: MIG_NO_REPLY;
 }
 
+/* Kludge just for console.  */
+#include <device/tty_status.h> /* TTY_* */
+#include <oskit/machine/pc/direct_cons.h>      /* direct_cons_set_flags, DC_* */
+
+io_return_t
+ds_asyncio_set_status(device_t dev, dev_flavor_t flavor,
+                     dev_status_t status, mach_msg_type_number_t status_count)
+{
+  /* Ensure that they are asking about the console.  */
+  if ((void *) dev->com_device != ds_console_stream)
+      return D_INVALID_OPERATION;
+
+  switch (flavor)
+    {
+      /* Flavors defined in direct_cons.h */
+    case DC_RAW:
+    case DC_NONBLOCK:  
+    case DC_NO_ONLCR:
+      direct_cons_set_flags((int) flavor);
+      return D_SUCCESS;
+
+      /* All of the rest are not yet implemented, but some are called, 
+        hence they fall-through here.  */
+
+      /* Flavors defined in tty_status.h */
+    case TTY_STATUS:
+    case TTY_MODEM:
+    case TTY_FLUSH:
+    case TTY_STOP:     
+    case TTY_START:
+    case TTY_SET_BREAK:
+    case TTY_CLEAR_BREAK:
+    case TTY_SET_TRANSLATION:
+    default:
+      return D_INVALID_OPERATION;
+    }
+}
+
 /* Kludge just for kmsg.  */
 void
 ds_asyncio_close (device_t dev)
@@ -389,6 +427,7 @@ const struct device_ops asyncio_device_o
 {
   write_inband: ds_asyncio_write_inband,
   read_inband: ds_asyncio_read_inband,
+  set_status: ds_asyncio_set_status,
   close: ds_asyncio_close
 };
 

Reply via email to