]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/console/serial_general.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / osfmk / console / serial_general.c
index fb2d0d6c506b86a071e7f4abf06e00e1a5abb1f4..34ba2b4e44f3521ef6344f049bfe5aa828bed105 100644 (file)
@@ -72,9 +72,9 @@ serial_keyboard_start(void)
 {
        /* Go see if there are any characters pending now */
        serial_keyboard_poll();
-       panic("serial_keyboard_start: we can't get back here\n");
 }
 
+__dead2
 void
 serial_keyboard_poll(void)
 {
@@ -113,8 +113,13 @@ switch_to_video_console(void)
 int
 switch_to_serial_console(void)
 {
+       extern bool serial_console_enabled;
        int old_cons_ops = cons_ops_index;
-       cons_ops_index = SERIAL_CONS_OPS;
+
+       if (serial_console_enabled) {
+               cons_ops_index = SERIAL_CONS_OPS;
+       }
+
        return old_cons_ops;
 }
 
@@ -156,7 +161,7 @@ console_printbuf_putc(int ch, void * arg)
        struct console_printbuf_state * info = (struct console_printbuf_state *)arg;
        info->total += 1;
        if (info->pos < (SERIAL_CONS_BUF_SIZE - 1)) {
-               info->str[info->pos] = ch;
+               info->str[info->pos] = (char)ch;
                info->pos += 1;
        } else {
                /*
@@ -168,7 +173,7 @@ console_printbuf_putc(int ch, void * arg)
                        info->str[info->pos] = '\0';
                        console_write(info->str, info->pos);
                        info->pos            = 0;
-                       info->str[info->pos] = ch;
+                       info->str[info->pos] = (char)ch;
                        info->pos += 1;
                }
        }