Skip to content

Instantly share code, notes, and snippets.

@bluetech
Created November 15, 2012 21:08
Show Gist options
  • Save bluetech/4081283 to your computer and use it in GitHub Desktop.
Save bluetech/4081283 to your computer and use it in GitHub Desktop.
Find core keybaord device id with XKB only
static int
get_core_kbd_device_id(struct app *app, uint8_t *out)
{
xcb_xkb_get_device_info_cookie_t cookie;
_cleanup_free_ xcb_xkb_get_device_info_reply_t *reply = NULL;
cookie = xcb_xkb_get_device_info(app->conn,
XCB_XKB_ID_USE_CORE_KBD,
0, 0, 0, 0, 0, 0);
reply = xcb_xkb_get_device_info_reply(app->conn, cookie, NULL);
if (!reply) {
warnx("couldn't get core keyboard xkb device info");
return -EFAULT;
}
*out = reply->deviceID;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment