Rev 3716 | Rev 3769 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3716 | Rev 3767 | ||
|---|---|---|---|
| Line 41... | Line 41... | ||
| 41 | #include <ipc/ipc.h> |
41 | #include <ipc/ipc.h> |
| 42 | #include <async.h> |
42 | #include <async.h> |
| 43 | #include <ipc/fb.h> |
43 | #include <ipc/fb.h> |
| 44 | #include <bool.h> |
44 | #include <bool.h> |
| 45 | #include <errno.h> |
45 | #include <errno.h> |
| - | 46 | #include <console/style.h> |
|
| 46 | 47 | ||
| 47 | #include "serial_console.h" |
48 | #include "serial_console.h" |
| 48 | 49 | ||
| 49 | #define MAX_CONTROL 20 |
50 | #define MAX_CONTROL 20 |
| 50 | 51 | ||
| Line 87... | Line 88... | ||
| 87 | while (i++) |
88 | while (i++) |
| 88 | serial_puts("\033M"); |
89 | serial_puts("\033M"); |
| 89 | } |
90 | } |
| 90 | } |
91 | } |
| 91 | 92 | ||
| - | 93 | /** ECMA-48 Set Graphics Rendition. */ |
|
| 92 | void serial_set_style(const unsigned int mode) |
94 | static void serial_sgr(const unsigned int mode) |
| 93 | { |
95 | { |
| 94 | char control[MAX_CONTROL]; |
96 | char control[MAX_CONTROL]; |
| 95 | snprintf(control, MAX_CONTROL, "\033[%um", mode); |
97 | snprintf(control, MAX_CONTROL, "\033[%um", mode); |
| 96 | serial_puts(control); |
98 | serial_puts(control); |
| 97 | } |
99 | } |
| Line 134... | Line 136... | ||
| 134 | int lastrow = 0; |
136 | int lastrow = 0; |
| 135 | int newcol; |
137 | int newcol; |
| 136 | int newrow; |
138 | int newrow; |
| 137 | int fgcolor; |
139 | int fgcolor; |
| 138 | int bgcolor; |
140 | int bgcolor; |
| - | 141 | int style; |
|
| 139 | int i; |
142 | int i; |
| 140 | 143 | ||
| 141 | if (client_connected) { |
144 | if (client_connected) { |
| 142 | ipc_answer_0(iid, ELIMIT); |
145 | ipc_answer_0(iid, ELIMIT); |
| 143 | return; |
146 | return; |
| Line 184... | Line 187... | ||
| 184 | case FB_CLEAR: |
187 | case FB_CLEAR: |
| 185 | serial_clrscr(); |
188 | serial_clrscr(); |
| 186 | retval = 0; |
189 | retval = 0; |
| 187 | break; |
190 | break; |
| 188 | case FB_SET_STYLE: |
191 | case FB_SET_STYLE: |
| - | 192 | style = IPC_GET_ARG1(call); |
|
| - | 193 | if (style == STYLE_EMPHASIS) |
|
| - | 194 | serial_sgr(1); |
|
| - | 195 | else |
|
| - | 196 | serial_sgr(0); |
|
| - | 197 | retval = 0; |
|
| - | 198 | break; |
|
| - | 199 | case FB_SET_COLOR: |
|
| - | 200 | fgcolor = IPC_GET_ARG1(call); |
|
| - | 201 | bgcolor = IPC_GET_ARG2(call); |
|
| - | 202 | if (fgcolor < bgcolor) |
|
| - | 203 | serial_sgr(0); |
|
| - | 204 | else |
|
| - | 205 | serial_sgr(7); |
|
| - | 206 | retval = 0; |
|
| - | 207 | break; |
|
| - | 208 | case FB_SET_RGB_COLOR: |
|
| 189 | fgcolor = IPC_GET_ARG1(call); |
209 | fgcolor = IPC_GET_ARG1(call); |
| 190 | bgcolor = IPC_GET_ARG2(call); |
210 | bgcolor = IPC_GET_ARG2(call); |
| 191 | if (fgcolor < bgcolor) |
211 | if (fgcolor < bgcolor) |
| 192 | serial_set_style(0); |
212 | serial_sgr(0); |
| 193 | else |
213 | else |
| 194 | serial_set_style(7); |
214 | serial_sgr(7); |
| 195 | retval = 0; |
215 | retval = 0; |
| 196 | break; |
216 | break; |
| 197 | case FB_SCROLL: |
217 | case FB_SCROLL: |
| 198 | i = IPC_GET_ARG1(call); |
218 | i = IPC_GET_ARG1(call); |
| 199 | if ((i > height) || (i < -height)) { |
219 | if ((i > height) || (i < -height)) { |