FreeBSD/usr.sbin/bluetooth/bthidd/kbd.c
/*
 * Translate given keymap and write keyscodes
 */
Translate given keymap and write keyscodes
Translate given keymap and write keyscodes
static void
kbd_write(bitstr_t *m, int32_t fb, int32_t make, int32_t fd)
{
	int32_t	i, *b, *eob, n, buf[64];
	b = buf;
	eob = b + sizeof(buf)/sizeof(buf[0]);
	i = fb;
	while (i < xsize) {
		if (bit_test(m, i)) {
			n = kbd_xlate(i, make, b, eob);
			if (n == -1) {
				write(fd, buf, (b - buf) * sizeof(buf[0]));
				b = buf;
				continue;
			}
			b += n;
		}
		i ++;
	}
	if (b != buf)
		write(fd, buf, (b - buf) * sizeof(buf[0]));
}
static void kbd_write ( bitstr_t * m , int32_t fb , int32_t make , int32_t fd ) { int32_t i , * b , * eob , n , buf [ 64 ] ; b = buf ; eob = b + sizeof ( buf ) / sizeof ( buf [ 0 ] ) ; i = fb ; while ( i < xsize ) { if ( bit_test ( m , i ) ) { n = kbd_xlate ( i , make , b , eob ) ; if ( n == -1 ) { write ( fd , buf , ( b - buf ) * sizeof ( buf [ 0 ] ) ) ; b = buf ; continue ; } b += n ; } i ++ ; } if ( b != buf ) write ( fd , buf , ( b - buf ) * sizeof ( buf [ 0 ] ) ) ; }
Translate given keymap and write keyscodes
Translate given keymap and write keyscodes