diff options
| -rw-r--r-- | 0001-Simulate-fake-Fn-key-on-PS-2-keyboards-w-o-one-eg.-C.patch | 157 | ||||
| -rw-r--r-- | 0001-kdbus-interprocess-message-router.patch | 82 | ||||
| -rw-r--r-- | series | 1 |
3 files changed, 210 insertions, 30 deletions
diff --git a/0001-Simulate-fake-Fn-key-on-PS-2-keyboards-w-o-one-eg.-C.patch b/0001-Simulate-fake-Fn-key-on-PS-2-keyboards-w-o-one-eg.-C.patch new file mode 100644 index 00000000000000..8f3b191874c7d4 --- /dev/null +++ b/0001-Simulate-fake-Fn-key-on-PS-2-keyboards-w-o-one-eg.-C.patch @@ -0,0 +1,157 @@ +>From 2b68920c417303e3adb90631ed9a9cbf864c0a94 Mon Sep 17 00:00:00 2001 +From: Dirk Hohndel <dirk@hohndel.org> +Date: Wed, 1 May 2013 11:23:28 -0700 +Subject: [PATCH 1/1] Simulate fake Fn key on PS/2 keyboards w/o one (eg. + Chromebook Pixel) + +This establishes a somewhat generic way to do this and implements a +specific solution for the Pixel where the right ALT key is redefined +to be an Fn key. + +Press/release events for the fake Fn key are no longer reported up, +but if the fake Fn key is pressed, then other keys are potentially +translated. + +Implemented in this patch are the following mappings: + BS -> Delete + Up -> PgUp + Down -> PgDn + Left -> Home + Right -> End + +Signed-off-by: Dirk Hohndel <dirk@hohndel.org> +--- + drivers/input/keyboard/atkbd.c | 80 +++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 80 insertions(+) + +--- a/drivers/input/keyboard/atkbd.c ++++ b/drivers/input/keyboard/atkbd.c +@@ -161,6 +161,19 @@ static const unsigned short atkbd_unxlat + #define ATKBD_KEY_UNKNOWN 0 + #define ATKBD_KEY_NULL 255 + ++#define ATKBD_KEY_IGNORE 0x8000 ++#define ATKBD_KEY_BS 0x0e ++#define ATKBD_KEY_DEL 0x53 /* actually E0 53 - same for the rest here */ ++#define ATKBD_KEY_ALT_R 0x38 ++#define ATKBD_KEY_HOME 0x47 ++#define ATKBD_KEY_UP 0x48 ++#define ATKBD_KEY_PGUP 0x49 ++#define ATKBD_KEY_LEFT 0x4b ++#define ATKBD_KEY_RIGHT 0x4d ++#define ATKBD_KEY_END 0x4f ++#define ATKBD_KEY_DOWN 0x50 ++#define ATKBD_KEY_PGDN 0x51 ++ + #define ATKBD_SCR_1 0xfffe + #define ATKBD_SCR_2 0xfffd + #define ATKBD_SCR_4 0xfffc +@@ -218,6 +231,7 @@ struct atkbd { + bool softraw; + bool scroll; + bool enabled; ++ bool fake_fn; + + /* Accessed only from interrupt */ + unsigned char emul; +@@ -242,6 +256,7 @@ struct atkbd { + static void (*atkbd_platform_fixup)(struct atkbd *, const void *data); + static void *atkbd_platform_fixup_data; + static unsigned int (*atkbd_platform_scancode_fixup)(struct atkbd *, unsigned int); ++static unsigned int (*atkbd_fake_fn_fixup)(struct atkbd *, unsigned int); + + static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, + ssize_t (*handler)(struct atkbd *, char *)); +@@ -398,6 +413,13 @@ static irqreturn_t atkbd_interrupt(struc + if (!atkbd->enabled) + goto out; + ++ if (atkbd_fake_fn_fixup) { ++ code = atkbd_fake_fn_fixup(atkbd, code); ++ if (code == ATKBD_KEY_IGNORE) ++ /* fake Fn key pressed - ignore */ ++ goto out; ++ } ++ + input_event(dev, EV_MSC, MSC_RAW, code); + + if (atkbd_platform_scancode_fixup) +@@ -988,6 +1010,48 @@ static unsigned int atkbd_oqo_01plus_sca + } + + /* ++ * Google Chromebook Pixel is lacking an Fn key. In order to use as ++ * a regular Linux laptop we steal the left Alt key and turn it into ++ * an Fn key ++ */ ++static unsigned int atkbd_pixel_fake_fn_fixup(struct atkbd *atkbd, unsigned int code) ++{ ++ if (atkbd->emul != 1) { ++ /* handle backspace here as it's the only one w/o ++ * a leading E0/E1 (i.e., emul == 0) */ ++ if (atkbd->emul == 0 && atkbd->fake_fn && (code & 0x7f) == ATKBD_KEY_BS) { ++ /* when pretending that Delete was pressed we need ++ * to set emul as well as Delete is E0 53 */ ++ atkbd->emul = 1; ++ code = (code & 0x80) | ATKBD_KEY_DEL; ++ } ++ } else if ((code & 0x7f) == ATKBD_KEY_ALT_R) { ++ atkbd->fake_fn = (code & 0x80) ? 0 : 1; ++ atkbd->emul = 0; ++ code = ATKBD_KEY_IGNORE; ++ } else if (atkbd->fake_fn) { ++ unsigned int oldcode = code; ++ switch(code & 0x7f) { ++ case ATKBD_KEY_UP: ++ code = ATKBD_KEY_PGUP; ++ break; ++ case ATKBD_KEY_DOWN: ++ code = ATKBD_KEY_PGDN; ++ break; ++ case ATKBD_KEY_LEFT: ++ code = ATKBD_KEY_HOME; ++ break; ++ case ATKBD_KEY_RIGHT: ++ code = ATKBD_KEY_END; ++ break; ++ } ++ code |= oldcode & 0x80; ++ } ++ return code; ++} ++ ++ ++/* + * atkbd_set_keycode_table() initializes keyboard's keycode table + * according to the selected scancode set + */ +@@ -1638,6 +1702,13 @@ static int __init atkbd_setup_scancode_f + return 1; + } + ++static int __init atkbd_setup_fake_fn_fixup(const struct dmi_system_id *id) ++{ ++ atkbd_fake_fn_fixup = id->driver_data; ++ ++ return 1; ++} ++ + static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = { + { + .matches = { +@@ -1775,6 +1846,15 @@ static const struct dmi_system_id atkbd_ + .callback = atkbd_setup_scancode_fixup, + .driver_data = atkbd_oqo_01plus_scancode_fixup, + }, ++ { ++ /* Google Chromebook Pixel */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Link"), ++ }, ++ .callback = atkbd_setup_fake_fn_fixup, ++ .driver_data = atkbd_pixel_fake_fn_fixup, ++ }, + { } + }; + diff --git a/0001-kdbus-interprocess-message-router.patch b/0001-kdbus-interprocess-message-router.patch index b20a24a0c87278..c563642cdf968c 100644 --- a/0001-kdbus-interprocess-message-router.patch +++ b/0001-kdbus-interprocess-message-router.patch @@ -8,15 +8,15 @@ Nothing to see here, move along... drivers/Makefile | 1 drivers/kdbus/Kconfig | 5 drivers/kdbus/Makefile | 4 - drivers/kdbus/bus.c | 122 +++++++++ + drivers/kdbus/bus.c | 122 ++++++++ drivers/kdbus/ep.c | 200 ++++++++++++++ - drivers/kdbus/kdbus.c | 610 +++++++++++++++++++++++++++++++++++++++++++++ - drivers/kdbus/kdbus.h | 201 ++++++++++++++ - drivers/kdbus/ns.c | 217 ++++++++++++++++ - include/uapi/kdbus/kdbus.h | 86 ++++++ + drivers/kdbus/kdbus.c | 611 +++++++++++++++++++++++++++++++++++++++++++++ + drivers/kdbus/kdbus.h | 185 +++++++++++++ + drivers/kdbus/ns.c | 217 +++++++++++++++ + include/uapi/kdbus/kdbus.h | 123 +++++++++ include/uapi/linux/major.h | 2 kdbus.c | 77 +++++ - 12 files changed, 1527 insertions(+) + 12 files changed, 1549 insertions(+) --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -379,7 +379,7 @@ Nothing to see here, move along... + --- /dev/null +++ b/drivers/kdbus/kdbus.c -@@ -0,0 +1,610 @@ +@@ -0,0 +1,611 @@ +/* + * kdbus - interprocess message routing + * @@ -934,7 +934,7 @@ Nothing to see here, move along... + } + + m->src_id = conn->id; -+ m->id = conn->ep->bus->msg_id_next++; ++ m->msg_id = conn->ep->bus->msg_id_next++; + *msg = m; + return 0; +out_err: @@ -951,7 +951,8 @@ Nothing to see here, move along... + return -ENOENT; + + pr_info("sending message %llu from %llu to %llu\n", -+ (unsigned long long)msg->id, (unsigned long long)msg->src_id, ++ (unsigned long long)msg->msg_id, ++ (unsigned long long)msg->src_id, + (unsigned long long)msg->dst_id); + + kdbus_msg_free(msg); @@ -992,7 +993,7 @@ Nothing to see here, move along... +MODULE_ALIAS("devname:kdbus/control"); --- /dev/null +++ b/drivers/kdbus/kdbus.h -@@ -0,0 +1,201 @@ +@@ -0,0 +1,185 @@ +/* + * Copyright (C) 2013 Kay Sievers + * Copyright (C) 2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> @@ -1130,22 +1131,6 @@ Nothing to see here, move along... + u32 flags; +}; + -+struct kdbus_msg { -+ u64 src_id; -+ u64 dst_id; -+ u64 flags; -+ uid_t src_uid; -+ gid_t src_gid; -+ pid_t src_pid; -+ pid_t src_tid; -+ u64 ts_nsec; -+ u64 id; -+ u64 reserved[8]; -+ u32 data_count; -+ struct kdbus_msg_data *data; -+}; -+ -+ +/* To knock around with for now */ +struct kdbus_test_msg { + struct kref kref; @@ -1416,7 +1401,7 @@ Nothing to see here, move along... + --- /dev/null +++ b/include/uapi/kdbus/kdbus.h -@@ -0,0 +1,86 @@ +@@ -0,0 +1,123 @@ +/* + * Copyright (C) 2013 Kay Sievers + * Copyright (C) 2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> @@ -1441,10 +1426,47 @@ Nothing to see here, move along... + char reserved[256]; +}; + -+struct kdbus_message { ++struct kdbus_fake_message { + char msg[256]; /* FIXME obviously... */ +}; + ++/** ++ * struct kdbus_msg ++ * ++ * set by userspace: ++ * dst_id: destination id ++ * filter: bloom filter for the kernel to use to filter messages ++ * data_count: number of data structures for this message ++ * data: data for the message ++ * ++ * set by kernel: ++ * msg_id: message id, to allow userspace to sort messages ++ * src_id: who sent the message ++ * src_uid: uid of sending process ++ * src_gid: gid of sending process ++ * src_pid: pid of sending process ++ * src_tid: tid of sending process ++ * ts_nsec: timestamp when message was sent to the kernel ++ * ++ */ ++struct kdbus_msg { ++ __u64 dst_id; ++ __u64 filter; ++ ++ __u64 msg_id; ++ __u64 src_id; ++ __u64 flags; ++ __kernel_uid_t src_uid; ++ __kernel_gid_t src_gid; ++ __kernel_pid_t src_pid; ++ __kernel_pid_t src_tid; ++ __u64 ts_nsec; ++ __u64 reserved[8]; ++ __u32 data_count; ++ struct kdbus_msg_data *data; ++}; ++ ++ + +#if 0 +/* Old-style dbus had the following message type: */ @@ -1498,8 +1520,8 @@ Nothing to see here, move along... + KDBUS_CMD_MATCH_ADD = _IOWR(KDBUS_IOC_MAGIC, 0x60, int), + KDBUS_CMD_MATCH_REMOVE = _IOWR(KDBUS_IOC_MAGIC, 0x61, int), + -+ KDBUS_CMD_MSG_SEND = _IOWR(KDBUS_IOC_MAGIC, 0x80, struct kdbus_message), -+ KDBUS_CMD_MSG_RECV = _IOWR(KDBUS_IOC_MAGIC, 0x81, struct kdbus_message), ++ KDBUS_CMD_MSG_SEND = _IOWR(KDBUS_IOC_MAGIC, 0x80, struct kdbus_fake_message), ++ KDBUS_CMD_MSG_RECV = _IOWR(KDBUS_IOC_MAGIC, 0x81, struct kdbus_fake_message), +}; + +#endif @@ -1,5 +1,6 @@ # My specific stuff, at the top to make it easier to work stuff below. driver-core-export-subsys_virtual_register.patch +0001-Simulate-fake-Fn-key-on-PS-2-keyboards-w-o-one-eg.-C.patch devnode_gid.patch 0001-kdbus-interprocess-message-router.patch dbus.patch |
