Lines Matching +full:device +full:- +full:width

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Minimalistic braille device kernel support.
5 * By default, shows console messages on the braille device.
8 * Copyright (C) Samuel Thibault <samuel.thibault@ens-lyon.org>
25 MODULE_AUTHOR("samuel.thibault@ens-lyon.org");
26 MODULE_DESCRIPTION("braille device");
30 * Braille device support part.
45 #define WIDTH 40 macro
47 static u16 console_buf[WIDTH];
57 static int lastVC = -1;
61 /* Very VisioBraille-specific */
64 static u16 lastwrite[WIDTH]; in braille_write()
65 unsigned char data[1 + 1 + 2*WIDTH + 2 + 1], csum = 0, *c; in braille_write()
72 if (!memcmp(lastwrite, buf, WIDTH * sizeof(*buf))) in braille_write()
74 memcpy(lastwrite, buf, WIDTH * sizeof(*buf)); in braille_write()
85 for (i = 0; i < WIDTH; i++) { in braille_write()
106 braille_co->write(braille_co, data, c - data); in braille_write()
112 vc_x = vc->state.x - (vc->state.x % WIDTH); in vc_follow_cursor()
113 vc_y = vc->state.y; in vc_follow_cursor()
114 lastvc_x = vc->state.x; in vc_follow_cursor()
115 lastvc_y = vc->state.y; in vc_follow_cursor()
121 if (vc->state.x != lastvc_x || vc->state.y != lastvc_y) in vc_maybe_cursor_moved()
128 u16 buf[WIDTH]; in vc_refresh()
131 for (i = 0; i < WIDTH; i++) { in vc_refresh()
133 2 * (vc_x + i) + vc_y * vc->vc_size_row); in vc_refresh()
147 struct vc_data *vc = param->vc; in keyboard_notifier_call()
150 if (!param->down) in keyboard_notifier_call()
156 if (param->value == BRAILLE_KEY) { in keyboard_notifier_call()
165 switch (param->value) { in keyboard_notifier_call()
169 lastVC = -1; in keyboard_notifier_call()
174 vc_x -= WIDTH; in keyboard_notifier_call()
179 vc_y--; in keyboard_notifier_call()
180 vc_x = vc->vc_cols-WIDTH; in keyboard_notifier_call()
185 if (vc_x + WIDTH < vc->vc_cols) { in keyboard_notifier_call()
186 vc_x += WIDTH; in keyboard_notifier_call()
187 } else if (vc_y + 1 < vc->vc_rows) { in keyboard_notifier_call()
195 if (vc_y + 1 < vc->vc_rows) in keyboard_notifier_call()
202 vc_y--; in keyboard_notifier_call()
215 vc_y = vc->vc_rows-1; in keyboard_notifier_call()
227 unsigned char type = KTYP(param->value) - 0xf0; in keyboard_notifier_call()
230 unsigned char val = KVAL(param->value); in keyboard_notifier_call()
231 int on_off = -1; in keyboard_notifier_call()
268 struct vc_data *vc = param->vc; in vt_notifier_call()
277 unsigned char c = param->c; in vt_notifier_call()
279 if (vc->vc_num != fg_console) in vt_notifier_call()
285 console_cursor--; in vt_notifier_call()
307 if (console_cursor == WIDTH) in vt_notifier_call()
309 (WIDTH-1) * sizeof(*console_buf)); in vt_notifier_call()
312 console_buf[console_cursor-1] = c; in vt_notifier_call()
326 if (vc->vc_num != lastVC) { in vt_notifier_call()
327 lastVC = vc->vc_num; in vt_notifier_call()
358 return -ENODEV; in braille_register_console()
359 if (console->setup) { in braille_register_console()
360 ret = console->setup(console, console_options); in braille_register_console()
364 console->flags |= CON_ENABLED; in braille_register_console()
365 console->index = index; in braille_register_console()
375 return -EINVAL; in braille_unregister_console()