[mini-os master] mini-os: Remove \r\n conversion when writing to PV serial port

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[mini-os master] mini-os: Remove \r\n conversion when writing to PV serial port

patchbot
commit 88c9b4357e5e7a2f3d7b7821a64a4454061631ed
Author:     Simon Waterman <[hidden email]>
AuthorDate: Wed May 10 23:33:23 2017 +0100
Commit:     Wei Liu <[hidden email]>
CommitDate: Thu May 11 15:19:54 2017 +0100

    mini-os: Remove \r\n conversion when writing to PV serial port
   
    This change removes \n to \r\n conversion when writing to a PV serial
    port so that binary protocols carried over the port are not corrupted.
   
    The change enables new use-cases for example connectivity from the Windows
    Kernel Debugger to a guest via it's IOEMU stubdom.
   
    Signed-off-by: Simon Waterman <[hidden email]>
    Reviewed-by: Wei Liu <[hidden email]>
    Acked-by: Samuel Thibault <[hidden email]>
    Acked-by: Keir Fraser <[hidden email]>
---
 console/console.c | 29 +----------------------------
 1 file changed, 1 insertion(+), 28 deletions(-)

diff --git a/console/console.c b/console/console.c
index 5538bd4..de94ad6 100644
--- a/console/console.c
+++ b/console/console.c
@@ -82,10 +82,6 @@ void xencons_tx(void)
 
 void console_print(struct consfront_dev *dev, char *data, int length)
 {
-    char *curr_char, saved_char;
-    char copied_str[length+1];
-    char *copied_ptr;
-    int part_len;
     int (*ring_send_fn)(struct consfront_dev *dev, const char *data, unsigned length);
 
     if(!console_initialised)
@@ -93,30 +89,7 @@ void console_print(struct consfront_dev *dev, char *data, int length)
     else
         ring_send_fn = xencons_ring_send;
 
-    copied_ptr = copied_str;
-    memcpy(copied_ptr, data, length);
-    for(curr_char = copied_ptr; curr_char < copied_ptr+length-1; curr_char++)
-    {
-        if(*curr_char == '\n')
-        {
-            *curr_char = '\r';
-            saved_char = *(curr_char+1);
-            *(curr_char+1) = '\n';
-            part_len = curr_char - copied_ptr + 2;
-            ring_send_fn(dev, copied_ptr, part_len);
-            *(curr_char+1) = saved_char;
-            copied_ptr = curr_char+1;
-            length -= part_len - 1;
-        }
-    }
-
-    if (copied_ptr[length-1] == '\n') {
-        copied_ptr[length-1] = '\r';
-        copied_ptr[length] = '\n';
-        length++;
-    }
-    
-    ring_send_fn(dev, copied_ptr, length);
+    ring_send_fn(dev, data, length);
 }
 
 void print(int direct, const char *fmt, va_list args)
--
generated by git-patchbot for /home/xen/git/mini-os.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog