On Fri, 16 Nov 2018 at 07:02:42 -0700, Aaron Bieber wrote:
> On Fri, 16 Nov 2018 at 06:55:09 -0700, Aaron Bieber wrote:
> > Hi,
> >
> > This diff is based off a diff Geert Hendrickx sent to bugs@ back in 2009. I
> > have updated it to add the 'swapctrlcaps' bit and removed the xenocara diff.
> >
> > https://marc.info/?l=openbsd-bugs&m=124284599329729
> >
> > Not sure if this didn't land because it was sent to bugs@ or if there are 
> > other
> > reasons. Please cluestick me if you know!
> >
> > OK?
> >
>

Here is a much cleaner version of the diff which adds proper man
entries and only modifies the keys that are different from KB_US.

OK?

diff --git a/share/man/man4/pckbd.4 b/share/man/man4/pckbd.4
index 45ad55d8765..0135c715bc0 100644
--- a/share/man/man4/pckbd.4
+++ b/share/man/man4/pckbd.4
@@ -162,6 +162,11 @@ British.
 .It KB_US
 .Pq us
 English/US keyboard mapping (default).
+.It KB_US | KB_COLEMAK
+.Pq us.colemak
+English/US keyboard with
+.Dq Colemak
+layout.
 .It KB_US | KB_DECLK
 .Pq us.declk
 English/US mapping for
@@ -180,7 +185,8 @@ variant.
 This switches off the
 .Dq dead accents .
 .Pp
-The KB_BE, KB_FR, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US and KB_US | KB_DVORAK
+The KB_BE, KB_FR, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US,
+KB_US | KB_DVORAK and KB_US | KB_COLEMAK
 mappings can be modified
 to swap the left Control and the Caps Lock keys by the
 KB_SWAPCTRLCAPS variant bit or the
diff --git a/share/man/man4/ukbd.4 b/share/man/man4/ukbd.4
index af218fa0910..211516596dd 100644
--- a/share/man/man4/ukbd.4
+++ b/share/man/man4/ukbd.4
@@ -198,6 +198,11 @@ British.
 .It KB_US
 .Pq us
 English/US keyboard mapping (default).
+.It KB_US | KB_COLEMAK
+.Pq us.colemak
+English/US keyboard with
+.Dq Colemak
+layout.
 .It KB_US | KB_DVORAK
 .Pq us.dvorak
 English/US keyboard with
@@ -212,8 +217,8 @@ variant.
 This switches off the
 .Dq dead accents .
 .Pp
-The KB_BE, KB_FR, KB_FR | KB_APPLE, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US and
-KB_US | KB_DVORAK
+The KB_BE, KB_FR, KB_FR | KB_APPLE, KB_FR | KB_DVORAK, KB_JP, KB_UK, KB_US,
+KB_US | KB_DVORAK and KB_US | KB_COLEMAK
 mappings can be modified
 to swap the left Control and the Caps Lock keys by the
 KB_SWAPCTRLCAPS variant bit or the
diff --git a/sys/dev/pckbc/wskbdmap_mfii.c b/sys/dev/pckbc/wskbdmap_mfii.c
index d10a909eece..8708ef96e11 100644
--- a/sys/dev/pckbc/wskbdmap_mfii.c
+++ b/sys/dev/pckbc/wskbdmap_mfii.c
@@ -597,6 +597,27 @@ static const keysym_t pckbd_keydesc_us_dvorak[] = {
     KC(53),                    KS_z,
 };

+static const keysym_t pckbd_keydesc_us_colemak[] = {
+/*  pos      command           normal          shifted */
+    KC(18),                    KS_f,
+    KC(19),                    KS_p,
+    KC(20),                    KS_g,
+    KC(21),                    KS_j,
+    KC(22),                    KS_l,
+    KC(23),                    KS_u,
+    KC(24),                    KS_y,
+    KC(25),                    KS_semicolon,   KS_colon,
+    KC(31),                    KS_r,
+    KC(32),                    KS_s,
+    KC(33),                    KS_t,
+    KC(34),                    KS_d,
+    KC(36),                    KS_n,
+    KC(37),                    KS_e,
+    KC(38),                    KS_i,           KS_I,
+    KC(39),                    KS_o,
+    KC(49),                    KS_k,
+};
+
 static const keysym_t pckbd_keydesc_swapctrlcaps[] = {
 /*  pos      command           normal          shifted */
     KC(29),                    KS_Caps_Lock,
@@ -1129,6 +1150,7 @@ const struct wscons_keydesc pckbd_keydesctab[] = {
        KBD_MAP(KB_NO | KB_NODEAD,      KB_NO,  pckbd_keydesc_no_nodead),
        KBD_MAP(KB_US | KB_DECLK,       KB_US,  pckbd_keydesc_us_declk),
        KBD_MAP(KB_US | KB_DVORAK,      KB_US,  pckbd_keydesc_us_dvorak),
+       KBD_MAP(KB_US | KB_COLEMAK,     KB_US,  pckbd_keydesc_us_colemak),
        KBD_MAP(KB_US | KB_SWAPCTRLCAPS, KB_US, pckbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_US | KB_IOPENER,     KB_US,  pckbd_keydesc_iopener),
        KBD_MAP(KB_UK | KB_SWAPCTRLCAPS, KB_UK, pckbd_keydesc_swapctrlcaps),
@@ -1139,6 +1161,8 @@ const struct wscons_keydesc pckbd_keydesctab[] = {
        KBD_MAP(KB_BE | KB_SWAPCTRLCAPS, KB_BE, pckbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_US | KB_DVORAK | KB_SWAPCTRLCAPS,    KB_US | KB_DVORAK,
                pckbd_keydesc_swapctrlcaps),
+       KBD_MAP(KB_US | KB_COLEMAK | KB_SWAPCTRLCAPS,   KB_US | KB_COLEMAK,
+               pckbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_US | KB_IOPENER | KB_SWAPCTRLCAPS,   KB_US | KB_IOPENER,
                pckbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_ES,                  KB_US,  pckbd_keydesc_es),
diff --git a/sys/dev/usb/ukbdmap.c b/sys/dev/usb/ukbdmap.c
index 3cf1dfe18ed..3048f468b85 100644
--- a/sys/dev/usb/ukbdmap.c
+++ b/sys/dev/usb/ukbdmap.c
@@ -626,6 +626,27 @@ static const keysym_t ukbd_keydesc_us_dvorak[] = {
     KC(56),    KS_z,
 };

+static const keysym_t ukbd_keydesc_us_colemak[] = {
+/*  pos      command           normal          shifted */
+    KC(18),                    KS_f,
+    KC(19),                    KS_p,
+    KC(20),                    KS_g,
+    KC(21),                    KS_j,
+    KC(22),                    KS_l,
+    KC(23),                    KS_u,
+    KC(24),                    KS_y,
+    KC(25),                    KS_semicolon,   KS_colon,
+    KC(31),                    KS_r,
+    KC(32),                    KS_s,
+    KC(33),                    KS_t,
+    KC(34),                    KS_d,
+    KC(36),                    KS_n,
+    KC(37),                    KS_e,
+    KC(38),                    KS_i,           KS_I,
+    KC(39),                    KS_o,
+    KC(49),                    KS_k,
+};
+
 static const keysym_t ukbd_keydesc_swapctrlcaps[] = {
 /*  pos      command           normal          shifted */
     KC(57),    KS_Cmd1,        KS_Control_L,
@@ -1179,6 +1200,7 @@ const struct wscons_keydesc ukbd_keydesctab[] = {
        KBD_MAP(KB_NO,                  KB_DK,  ukbd_keydesc_no),
        KBD_MAP(KB_NO | KB_NODEAD,      KB_NO,  ukbd_keydesc_no_nodead),
        KBD_MAP(KB_US | KB_DVORAK,      KB_US,  ukbd_keydesc_us_dvorak),
+       KBD_MAP(KB_US | KB_COLEMAK,     KB_US,  ukbd_keydesc_us_colemak),
        KBD_MAP(KB_US | KB_SWAPCTRLCAPS, KB_US, ukbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_US | KB_IOPENER,     KB_US,  ukbd_keydesc_iopener),
        KBD_MAP(KB_UK | KB_SWAPCTRLCAPS, KB_UK, ukbd_keydesc_swapctrlcaps),
@@ -1191,6 +1213,8 @@ const struct wscons_keydesc ukbd_keydesctab[] = {
        KBD_MAP(KB_BE | KB_SWAPCTRLCAPS, KB_BE, ukbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_US | KB_DVORAK | KB_SWAPCTRLCAPS,    KB_US | KB_DVORAK,
                ukbd_keydesc_swapctrlcaps),
+       KBD_MAP(KB_US | KB_COLEMAK | KB_SWAPCTRLCAPS,   KB_US | KB_COLEMAK,
+               ukbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_US | KB_IOPENER | KB_SWAPCTRLCAPS,   KB_US | KB_IOPENER,
                ukbd_keydesc_swapctrlcaps),
        KBD_MAP(KB_ES,                  KB_US,  ukbd_keydesc_es),
diff --git a/sys/dev/wscons/wsksymdef.h b/sys/dev/wscons/wsksymdef.h
index 486b8840c4f..4a2e7b70d5f 100644
--- a/sys/dev/wscons/wsksymdef.h
+++ b/sys/dev/wscons/wsksymdef.h
@@ -746,6 +746,7 @@
 #define KB_IOPENER             0x00000040 /* f1-f12 -> ESC,f1-f11 */
 #define KB_MACHDEP             0x00000080 /* machine dependent */
 #define KB_APPLE               0x00010000 /* Apple specific layout */
+#define KB_COLEMAK             0x02000000 /* Colemak layout */
 #define KB_DEFAULT             0x80000000 /* (attach-only) default layout */

 #define KB_ENCTAB \
@@ -788,6 +789,7 @@
        { KB_METAESC,   "metaesc" }, \
        { KB_IOPENER,   "iopener" }, \
        { KB_MACHDEP,   "machdep" }, \
-       { KB_APPLE,     "apple" }
+       { KB_APPLE,     "apple" }, \
+       { KB_COLEMAK,   "colemak" }

 #endif /* !_DEV_WSCONS_WSKSYMDEF_H_ */

--
PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE

Reply via email to