Lines Matching +full:- +full:1

4  * Copyright (c) 2008, 2010-2011, 2016-2017 Samuel Thibault
28 #include "qemu/main-loop.h"
91 #define Y_MAX 1
110 #define TYPE_CHARDEV_BRAILLE "chardev-braille"
135 DO(BRLAPI_DOTS(1, 0, 0, 0, 0, 0, 0, 0), 'a'),
136 DO(BRLAPI_DOTS(1, 1, 0, 0, 0, 0, 0, 0), 'b'),
137 DO(BRLAPI_DOTS(1, 0, 0, 1, 0, 0, 0, 0), 'c'),
138 DO(BRLAPI_DOTS(1, 0, 0, 1, 1, 0, 0, 0), 'd'),
139 DO(BRLAPI_DOTS(1, 0, 0, 0, 1, 0, 0, 0), 'e'),
140 DO(BRLAPI_DOTS(1, 1, 0, 1, 0, 0, 0, 0), 'f'),
141 DO(BRLAPI_DOTS(1, 1, 0, 1, 1, 0, 0, 0), 'g'),
142 DO(BRLAPI_DOTS(1, 1, 0, 0, 1, 0, 0, 0), 'h'),
143 DO(BRLAPI_DOTS(0, 1, 0, 1, 0, 0, 0, 0), 'i'),
144 DO(BRLAPI_DOTS(0, 1, 0, 1, 1, 0, 0, 0), 'j'),
145 DO(BRLAPI_DOTS(1, 0, 1, 0, 0, 0, 0, 0), 'k'),
146 DO(BRLAPI_DOTS(1, 1, 1, 0, 0, 0, 0, 0), 'l'),
147 DO(BRLAPI_DOTS(1, 0, 1, 1, 0, 0, 0, 0), 'm'),
148 DO(BRLAPI_DOTS(1, 0, 1, 1, 1, 0, 0, 0), 'n'),
149 DO(BRLAPI_DOTS(1, 0, 1, 0, 1, 0, 0, 0), 'o'),
150 DO(BRLAPI_DOTS(1, 1, 1, 1, 0, 0, 0, 0), 'p'),
151 DO(BRLAPI_DOTS(1, 1, 1, 1, 1, 0, 0, 0), 'q'),
152 DO(BRLAPI_DOTS(1, 1, 1, 0, 1, 0, 0, 0), 'r'),
153 DO(BRLAPI_DOTS(0, 1, 1, 1, 0, 0, 0, 0), 's'),
154 DO(BRLAPI_DOTS(0, 1, 1, 1, 1, 0, 0, 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0, 0, 1, 0, 0), '-'),
203 DO(BRLAPI_DOTS(1, 0, 0, 0, 0, 1, 0, 0), '*'),
204 DO(BRLAPI_DOTS(0, 0, 1, 1, 0, 0, 0, 0), '/'),
205 DO(BRLAPI_DOTS(1, 1, 1, 0, 1, 1, 0, 0), '('),
206 DO(BRLAPI_DOTS(0, 1, 1, 1, 1, 1, 0, 0), ')'),
208 DO(BRLAPI_DOTS(1, 1, 1, 1, 0, 1, 0, 0), '&'),
209 DO(BRLAPI_DOTS(0, 0, 1, 1, 1, 1, 0, 0), '#'),
211 DO(BRLAPI_DOTS(0, 0, 0, 0, 0, 1, 0, 0), ','),
212 DO(BRLAPI_DOTS(0, 0, 0, 0, 1, 1, 0, 0), ';'),
213 DO(BRLAPI_DOTS(1, 0, 0, 0, 1, 1, 0, 0), ':'),
214 DO(BRLAPI_DOTS(0, 1, 1, 1, 0, 1, 0, 0), '!'),
215 DO(BRLAPI_DOTS(1, 0, 0, 1, 1, 1, 0, 0), '?'),
216 DO(BRLAPI_DOTS(0, 0, 0, 0, 1, 0, 0, 0), '"'),
217 DO(BRLAPI_DOTS(0, 0, 1, 0, 0, 0, 0, 0), '\''),
218 DO(BRLAPI_DOTS(0, 0, 0, 1, 0, 0, 0, 0), '`'),
219 DO(BRLAPI_DOTS(0, 0, 0, 1, 1, 0, 1, 0), '^'),
220 DO(BRLAPI_DOTS(0, 0, 0, 1, 1, 0, 0, 0), '~'),
221 DO(BRLAPI_DOTS(0, 1, 0, 1, 0, 1, 1, 0), '['),
222 DO(BRLAPI_DOTS(1, 1, 0, 1, 1, 1, 1, 0), ']'),
223 DO(BRLAPI_DOTS(0, 1, 0, 1, 0, 1, 0, 0), '{'),
224 DO(BRLAPI_DOTS(1, 1, 0, 1, 1, 1, 0, 0), '}'),
225 DO(BRLAPI_DOTS(1, 1, 1, 1, 1, 1, 0, 0), '='),
226 DO(BRLAPI_DOTS(1, 1, 0, 0, 0, 1, 0, 0), '<'),
227 DO(BRLAPI_DOTS(0, 0, 1, 1, 1, 0, 0, 0), '>'),
228 DO(BRLAPI_DOTS(1, 1, 0, 1, 0, 1, 0, 0), '$'),
229 DO(BRLAPI_DOTS(1, 0, 0, 1, 0, 1, 0, 0), '%'),
230 DO(BRLAPI_DOTS(0, 0, 0, 1, 0, 0, 1, 0), '@'),
231 DO(BRLAPI_DOTS(1, 1, 0, 0, 1, 1, 0, 0), '|'),
232 DO(BRLAPI_DOTS(1, 1, 0, 0, 1, 1, 1, 0), '\\'),
233 DO(BRLAPI_DOTS(0, 0, 0, 1, 1, 1, 0, 0), '_'),
242 if (baum->deferred_init) { in baum_deferred_init()
243 return 1; in baum_deferred_init()
246 if (brlapi__getDisplaySize(baum->brlapi, &baum->x, &baum->y) == -1) { in baum_deferred_init()
250 if (baum->y > Y_MAX) { in baum_deferred_init()
251 baum->y = Y_MAX; in baum_deferred_init()
253 if (baum->x > X_MAX) { in baum_deferred_init()
254 baum->x = X_MAX; in baum_deferred_init()
260 if (tty == -1) in baum_deferred_init()
264 if (brlapi__enterTtyMode(baum->brlapi, tty, NULL) == -1) { in baum_deferred_init()
268 baum->deferred_init = 1; in baum_deferred_init()
269 return 1; in baum_deferred_init()
278 if (!baum->out_buf_used) in baum_chr_accept_input()
283 if (room > baum->out_buf_used) in baum_chr_accept_input()
284 room = baum->out_buf_used; in baum_chr_accept_input()
286 first = BUF_SIZE - baum->out_buf_ptr; in baum_chr_accept_input()
288 qemu_chr_be_write(chr, baum->out_buf + baum->out_buf_ptr, first); in baum_chr_accept_input()
289 baum->out_buf_ptr = 0; in baum_chr_accept_input()
290 baum->out_buf_used -= first; in baum_chr_accept_input()
291 room -= first; in baum_chr_accept_input()
293 qemu_chr_be_write(chr, baum->out_buf + baum->out_buf_ptr, room); in baum_chr_accept_input()
294 baum->out_buf_ptr += room; in baum_chr_accept_input()
295 baum->out_buf_used -= room; in baum_chr_accept_input()
302 g_autofree uint8_t *io_buf = g_malloc(1 + 2 * len); in baum_write_packet()
306 while (len--) in baum_write_packet()
310 len = cur - io_buf; in baum_write_packet()
319 len -= room; in baum_write_packet()
321 if (len > BUF_SIZE - baum->out_buf_used) { in baum_write_packet()
324 baum->out_buf_used = 0; in baum_write_packet()
325 baum->out_buf_ptr = 0; in baum_write_packet()
327 out = baum->out_buf_ptr; in baum_write_packet()
328 baum->out_buf_used += len; in baum_write_packet()
329 first = BUF_SIZE - baum->out_buf_ptr; in baum_write_packet()
331 memcpy(baum->out_buf + out, cur, first); in baum_write_packet()
333 len -= first; in baum_write_packet()
336 memcpy(baum->out_buf + out, cur, len); in baum_write_packet()
344 uint8_t cell_count[] = { BAUM_RSP_CellCount, baum->x * baum->y }; in baum_cellCount_timer_cb()
355 if (!len--) in baum_eat_packet()
359 if (!len--) in baum_eat_packet()
363 DPRINTF("Dropped %td bytes!\n", cur - buf); in baum_eat_packet()
367 if (!len--) \ in baum_eat_packet()
370 if (!len--) \ in baum_eat_packet()
374 if (timer_pending(baum->cellCount_timer)) { \ in baum_eat_packet()
375 timer_del(baum->cellCount_timer); \ in baum_eat_packet()
378 return (cur - 2 - buf); \ in baum_eat_packet()
394 timer_mod(baum->cellCount_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + in baum_eat_packet()
396 for (i = 0; i < baum->x * baum->y ; i++) { in baum_eat_packet()
401 cursor = i + 1; in baum_eat_packet()
410 timer_del(baum->cellCount_timer); in baum_eat_packet()
412 memset(zero, 0, baum->x * baum->y); in baum_eat_packet()
416 .regionBegin = 1, in baum_eat_packet()
417 .regionSize = baum->x * baum->y, in baum_eat_packet()
419 .textSize = baum->x * baum->y, in baum_eat_packet()
423 .charset = (char *)"ISO-8859-1", in baum_eat_packet()
426 if (brlapi__write(baum->brlapi, &wa) == -1) in baum_eat_packet()
452 identity[11] = '0' + baum->x / 10; in baum_eat_packet()
453 identity[12] = '0' + baum->x % 10; in baum_eat_packet()
459 uint8_t version[] = { BAUM_RSP_VersionNumber, 1 }; /* ? */ in baum_eat_packet()
481 if (!len--) in baum_eat_packet()
484 cur--; in baum_eat_packet()
487 return cur - buf; in baum_eat_packet()
498 if (!baum->brlapi) in baum_chr_write()
506 if (tocopy > BUF_SIZE - baum->in_buf_used) in baum_chr_write()
507 tocopy = BUF_SIZE - baum->in_buf_used; in baum_chr_write()
509 memcpy(baum->in_buf + baum->in_buf_used, buf, tocopy); in baum_chr_write()
510 baum->in_buf_used += tocopy; in baum_chr_write()
512 len -= tocopy; in baum_chr_write()
516 while (cur < baum->in_buf_used && in baum_chr_write()
517 (eaten = baum_eat_packet(baum, baum->in_buf + cur, baum->in_buf_used - cur))) in baum_chr_write()
522 memmove(baum->in_buf, baum->in_buf + cur, baum->in_buf_used - cur); in baum_chr_write()
523 baum->in_buf_used -= cur; in baum_chr_write()
553 if (!baum->brlapi) in baum_chr_read()
557 while ((ret = brlapi__readKey(baum->brlapi, 0, &code)) == 1) { in baum_chr_read()
564 baum_send_key(baum, BAUM_RSP_RoutingKey, (code & BRLAPI_KEY_CMD_ARG_MASK)+1); in baum_chr_read()
626 if (ret == -1 && (brlapi_errno != BRLAPI_ERROR_LIBCERR || errno != EINTR)) { in baum_chr_read()
628 brlapi__closeConnection(baum->brlapi); in baum_chr_read()
629 g_free(baum->brlapi); in baum_chr_read()
630 baum->brlapi = NULL; in baum_chr_read()
638 timer_free(baum->cellCount_timer); in char_braille_finalize()
639 if (baum->brlapi) { in char_braille_finalize()
640 brlapi__closeConnection(baum->brlapi); in char_braille_finalize()
641 g_free(baum->brlapi); in char_braille_finalize()
654 baum->brlapi = handle; in baum_chr_open()
656 baum->brlapi_fd = brlapi__openConnection(handle, NULL, NULL); in baum_chr_open()
657 if (baum->brlapi_fd == -1) { in baum_chr_open()
661 baum->brlapi = NULL; in baum_chr_open()
664 baum->deferred_init = 0; in baum_chr_open()
666 baum->cellCount_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, baum_cellCount_timer_cb, baum); in baum_chr_open()
668 qemu_set_fd_handler(baum->brlapi_fd, baum_chr_read, NULL, baum); in baum_chr_open()
675 cc->open = baum_chr_open; in char_braille_class_init()
676 cc->chr_write = baum_chr_write; in char_braille_class_init()
677 cc->chr_accept_input = baum_chr_accept_input; in char_braille_class_init()