[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



commit 94cb25eb73e58e5c825c1ad5f6cf3d2647603a50
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Mon May 15 16:35:51 2017 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Mon May 15 16:35:51 2017 +0100

    Revert "mini-os: Remove \r\n conversion when writing to PV serial port"
    
    This reverts commit 88c9b4357e5e7a2f3d7b7821a64a4454061631ed.
---
 console/console.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/console/console.c b/console/console.c
index de94ad6..5538bd4 100644
--- a/console/console.c
+++ b/console/console.c
@@ -82,6 +82,10 @@ 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)
@@ -89,7 +93,30 @@ void console_print(struct consfront_dev *dev, char *data, 
int length)
     else
         ring_send_fn = xencons_ring_send;
 
-    ring_send_fn(dev, data, length);
+    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);
 }
 
 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
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.