From: Danny Milosavljevic <dannym@scratchpost.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Vagrant Cascadian <vagrant@debian.org>, 34978@debbugs.gnu.org
Subject: [bug#34978] Enable support for veyron chrombooks
Date: Wed, 3 Apr 2019 18:59:57 +0200 [thread overview]
Message-ID: <20190403185957.54228ce5@scratchpost.org> (raw)
In-Reply-To: <87d0m3rr6v.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 2863 bytes --]
> BTW, if U-Boot and Depthcharge are able to install custom keymaps, it’d
> be nice to implement that support like commit
> 8d058e7b1b1a409d3d9cc29c5650a98db4e78783 does for GRUB.
Heh, I wish U-Boot did that, but it really doesn't:
/* Translate the scancode in ASCII */
static int usb_kbd_translate(struct usb_kbd_pdata *data, unsigned char scancode,
unsigned char modifier, int pressed)
{
uint8_t keycode = 0;
/* Key released */
if (pressed == 0) {
data->repeat_delay = 0;
return 0;
}
if (pressed == 2) {
data->repeat_delay++;
if (data->repeat_delay < REPEAT_DELAY)
return 0;
data->repeat_delay = REPEAT_DELAY;
}
/* Alphanumeric values */
if ((scancode > 3) && (scancode <= 0x1d)) {
keycode = scancode - 4 + 'a';
if (data->flags & USB_KBD_CAPSLOCK)
keycode &= ~CAPITAL_MASK;
if (modifier & (LEFT_SHIFT | RIGHT_SHIFT)) {
/* Handle CAPSLock + Shift pressed simultaneously */
if (keycode & CAPITAL_MASK)
keycode &= ~CAPITAL_MASK;
else
keycode |= CAPITAL_MASK;
}
}
if ((scancode > 0x1d) && (scancode < 0x39)) {
/* Shift pressed */
if (modifier & (LEFT_SHIFT | RIGHT_SHIFT))
keycode = usb_kbd_numkey_shifted[scancode - 0x1e];
else
keycode = usb_kbd_numkey[scancode - 0x1e];
}
/* Arrow keys */
if ((scancode >= 0x4f) && (scancode <= 0x52))
keycode = usb_kbd_arrow[scancode - 0x4f];
/* Numeric keypad */
if ((scancode >= 0x54) && (scancode <= 0x67))
keycode = usb_kbd_num_keypad[scancode - 0x54];
if (data->flags & USB_KBD_CTRL)
keycode = scancode - 0x3;
if (pressed == 1) {
if (scancode == NUM_LOCK) {
data->flags ^= USB_KBD_NUMLOCK;
return 1;
}
if (scancode == CAPS_LOCK) {
data->flags ^= USB_KBD_CAPSLOCK;
return 1;
}
if (scancode == SCROLL_LOCK) {
data->flags ^= USB_KBD_SCROLLLOCK;
return 1;
}
}
/* Report keycode if any */
if (keycode) {
debug("%c", keycode);
usb_kbd_put_queue(data, keycode);
}
return 0;
}
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2019-04-03 17:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-24 18:02 [bug#34978] Enable support for veyron chrombooks Vagrant Cascadian
2019-03-24 18:24 ` Vagrant Cascadian
2019-03-26 22:50 ` Vagrant Cascadian
2019-03-27 9:24 ` Efraim Flashner
2019-03-27 15:14 ` Vagrant Cascadian
2019-04-03 16:26 ` Ludovic Courtès
2019-04-03 16:59 ` Danny Milosavljevic [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190403185957.54228ce5@scratchpost.org \
--to=dannym@scratchpost.org \
--cc=34978@debbugs.gnu.org \
--cc=ludo@gnu.org \
--cc=vagrant@debian.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.