diff --git a/aports/device/device-nokia-rx51/APKBUILD b/aports/device/device-nokia-rx51/APKBUILD index b3d9b934..a83252da 100644 --- a/aports/device/device-nokia-rx51/APKBUILD +++ b/aports/device/device-nokia-rx51/APKBUILD @@ -1,19 +1,31 @@ pkgname=device-nokia-rx51 pkgver=1 -pkgrel=13 +pkgrel=14 pkgdesc="Nokia N900" url="https://github.com/postmarketOS" arch="noarch" license="MIT" -depends="linux-postmarketos uboot-tools linux-firmware" -makedepends="uboot-tools" +depends="linux-postmarketos uboot-tools linux-firmware kbd kbd-bkeymaps" +makedepends="uboot-tools kbd kbd-bkeymaps" install="$pkgname.post-install" subpackages="" -source="deviceinfo uboot-script.cmd backlight-enable.sh 90-touchscreen-dev.rules acpi_handler.sh acpi.map $install" +source=" + deviceinfo + uboot-script.cmd + backlight-enable.sh + 90-touchscreen-dev.rules + acpi_handler.sh + acpi.map + keymaps/rx51_us.map + $install +" options="!check" build() { mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n postmarketos -d "$srcdir/uboot-script.cmd" "$srcdir/boot.scr" + mkdir "$srcdir"/keymaps + loadkeys -b "$srcdir"/rx51_us.map > "$srcdir"/keymaps/rx51_us.bmap + gzip "$srcdir"/keymaps/rx51_us.bmap return 0 } @@ -31,12 +43,15 @@ package() { "$pkgdir"/etc/acpi/handler.sh install -D -m644 "$srcdir"/acpi.map\ "$pkgdir"/etc/acpi.map + install -D -m644 "$srcdir"/keymaps/rx51_us.bmap.gz\ + "$pkgdir"/usr/share/bkeymaps/us/rx51_us.bmap.gz } -sha512sums="4efa28cfb35b0ceb783f15fbcf05d7302690d2d767ec7b87578741ccd52988fdc2095baf2a5ce66b964fb0cb151d05238f223a60a9a52c3670bd7b20ead2862a deviceinfo +sha512sums="cecba9a4a5ba6ddd736e4a46eecac20865d6c4d7a2d95efbbc33d1e8cacf9e3583aa80118fd5044da6ee08997d9d2c59af4f896692859b6e2e39e55fa515b566 deviceinfo a6d1c097bdc06f6d93527487d3779e20d16e290421615de5fa13a3b41bc318f44a35ec9058acd107290ce407f99f74f7dbfcf48b363c9f580c394cec4ba50e77 uboot-script.cmd 3d55e34b95791636e44a5f41754f3d0de039dbba41f7a556d43a95c9e64afcfa930046b4b96b40020b6f196096ffba93514682927e32fa4488686fdd19c6da5a backlight-enable.sh 98c554a709d6e8da5835bd792d833355d830fca1cfea12ec7fe4f41d1d1126389c51a8a392a7f94093473c19263cc6846cc40d7e179c2facf12db2d68ff923f9 90-touchscreen-dev.rules df5dcae9a32d04ba2fed8b4dbb8722f8d56d063a288dfbaeca37806bdbb8ba4de639b392859b9f24040a1032456d5dcd754f51314e3ab66515b91ae1e03c93a7 acpi_handler.sh 7761aec6e6e219245b006e7bdc1d19812e9c5915cf3e64bb3dd46bb4b5570c1715650b53a1fc1007cb814076b5d81be0a66ba7ebf06d9a1fa4e364725c3ee633 acpi.map +c9ff8b5968fe94007e1139db5ae76f3ee6c214356bff297b9672276c6adb332ba2342b6ca54cf7992d6556f3c68a13ef49ae5e61abe86154935514034170e228 rx51_us.map f5be149afc242543e4683532a703d7451e1b934e6c23363ea3bd38df307ae7cf657ac875cfb36152ad82f2dc056885fae8e65082eb8e3c73bd01ae44ed2224e8 device-nokia-rx51.post-install" diff --git a/aports/device/device-nokia-rx51/deviceinfo b/aports/device/device-nokia-rx51/deviceinfo index da1863d8..dee1a98c 100644 --- a/aports/device/device-nokia-rx51/deviceinfo +++ b/aports/device/device-nokia-rx51/deviceinfo @@ -6,6 +6,7 @@ deviceinfo_name="Nokia N900" deviceinfo_manufacturer="Nokia" deviceinfo_date="" deviceinfo_keyboard="true" +deviceinfo_keymaps="us/rx51_us" deviceinfo_nonfree="????" deviceinfo_dtb="omap3-n900" deviceinfo_modules_initfs="tsc2005 tsc200x-core omap_wdt twl4030_wdt" diff --git a/aports/device/device-nokia-rx51/keymaps/rx51_us.map b/aports/device/device-nokia-rx51/keymaps/rx51_us.map new file mode 100644 index 00000000..a79abb5e --- /dev/null +++ b/aports/device/device-nokia-rx51/keymaps/rx51_us.map @@ -0,0 +1,110 @@ +keymaps 0-4 +# +keycode 14 = Delete + shift keycode 14 = Remove + altgr keycode 14 = Escape + shift altgr keycode 14 = F12 +keycode 16 = q + altgr keycode 16 = one + shift altgr keycode 16 = F1 +keycode 17 = w + altgr keycode 17 = two + shift altgr keycode 17 = F2 +keycode 18 = e + altgr keycode 18 = three + shift altgr keycode 18 = F3 +keycode 19 = r + altgr keycode 19 = four + shift altgr keycode 19 = F4 +keycode 20 = t + altgr keycode 20 = five + shift altgr keycode 20 = F5 +keycode 21 = y + altgr keycode 21 = six + shift altgr keycode 21 = F6 +keycode 22 = u + altgr keycode 22 = seven + shift altgr keycode 22 = F7 +keycode 23 = i + altgr keycode 23 = eight + shift altgr keycode 23 = F8 +keycode 24 = o + altgr keycode 24 = nine + shift altgr keycode 24 = F9 +keycode 25 = p + altgr keycode 25 = zero + shift altgr keycode 25 = F10 +keycode 28 = Return + altgr keycode 28 = Tab +keycode 29 = Control + altgr keycode 29 = Compose +keycode 30 = a + altgr keycode 30 = asterisk +keycode 31 = s + altgr keycode 31 = plus +keycode 32 = d + altgr keycode 32 = numbersign + shift altgr keycode 32 = percent +keycode 33 = f + altgr keycode 33 = minus + shift altgr keycode 33 = asciitilde +keycode 34 = g + altgr keycode 34 = underscore +keycode 35 = h + altgr keycode 35 = parenleft +keycode 36 = j + altgr keycode 36 = parenright +keycode 37 = k + altgr keycode 37 = ampersand +keycode 38 = l + altgr keycode 38 = exclam + shift altgr keycode 38 = bar +keycode 42 = Shift +keycode 44 = z + altgr keycode 44 = sterling +keycode 45 = x + altgr keycode 45 = dollar +keycode 46 = c + altgr keycode 46 = euro + shift altgr keycode 46 = asciitilde +keycode 47 = v + altgr keycode 47 = slash + shift altgr keycode 47 = less +keycode 48 = b + altgr keycode 48 = backslash + shift altgr keycode 48 = greater +keycode 49 = n + altgr keycode 49 = quotedbl + shift altgr keycode 49 = braceleft +keycode 50 = m + altgr keycode 50 = apostrophe + shift altgr keycode 50 = braceright +keycode 51 = comma + shift keycode 51 = semicolon + altgr keycode 51 = equal + shift altgr keycode 51 = F11 +keycode 52 = period + shift keycode 52 = colon + altgr keycode 52 = question +keycode 57 = space + shift keycode 57 = Tab + altgr keycode 57 = at +keycode 65 = Meta_b + shift keycode 65 = Meta_y + altgr keycode 65 = Decr_Console +keycode 66 = Meta_f + shift keycode 66 = Meta_r + altgr keycode 66 = Incr_Console +keycode 100 = AltGr +keycode 103 = Up + altgr keycode 103 = Prior + shift altgr keycode 103 = Scroll_Backward +keycode 105 = Left + altgr keycode 105 = Home +keycode 106 = Right + altgr keycode 106 = End +keycode 108 = Down + altgr keycode 108 = Next + shift altgr keycode 108 = Scroll_Forward +compose '(' '(' to '[' +compose ')' ')' to ']' diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py index dd18fe9c..d0daa0c7 100644 --- a/pmb/config/__init__.py +++ b/pmb/config/__init__.py @@ -56,6 +56,7 @@ defaults = { "work": os.path.expanduser("~") + "/.local/var/pmbootstrap", "port_distccd": "33632", "ui": "weston", + "keymap": "", # aes-xts-plain64 would be better, but this is not supported on LineageOS # kernel configs @@ -191,6 +192,9 @@ deviceinfo_attributes = [ # weston "weston_pixman_type", + + # keymaps + "keymaps", ] # diff --git a/pmb/config/init.py b/pmb/config/init.py index 2346aadf..c6bd3b36 100644 --- a/pmb/config/init.py +++ b/pmb/config/init.py @@ -25,6 +25,7 @@ import pmb.helpers.cli import pmb.helpers.devices import pmb.helpers.ui import pmb.chroot.zap +import pmb.parse.deviceinfo def ask_for_work_path(args): @@ -60,6 +61,24 @@ def ask_for_ui(args): " one from the list above.") +def ask_for_keymaps(args, device): + info = pmb.parse.deviceinfo(args, device=device) + if "keymaps" not in info or info["keymaps"].strip() == "": + return "" + options = info["keymaps"].split(' ') + logging.info("Available keymaps for device (" + str(len(options)) + + "): " + ", ".join(options)) + if args.keymap is "": + args.keymap = options[0] + + while True: + ret = pmb.helpers.cli.ask(args, "Keymap", None, args.keymap, True) + if ret in options: + return ret + logging.fatal("ERROR: Invalid keymap specified, please type in" + " one from the list above.") + + def init(args): cfg = pmb.config.load(args) @@ -74,6 +93,10 @@ def init(args): device_exists = os.path.exists(args.aports + "/device/device-" + cfg["pmbootstrap"]["device"] + "/deviceinfo") + # Device keymap + if device_exists: + cfg["pmbootstrap"]["keymap"] = ask_for_keymaps(args, device=cfg["pmbootstrap"]["device"]) + # UI and work folder cfg["pmbootstrap"]["ui"] = ask_for_ui(args) cfg["pmbootstrap"]["work"] = ask_for_work_path(args) diff --git a/pmb/install/install.py b/pmb/install/install.py index 6fb74725..b3a7b4e3 100644 --- a/pmb/install/install.py +++ b/pmb/install/install.py @@ -26,7 +26,6 @@ import pmb.chroot.other import pmb.chroot.initfs import pmb.config import pmb.helpers.run -import pmb.helpers.other import pmb.install.blockdevice import pmb.install @@ -134,6 +133,25 @@ def copy_ssh_key(args): logging.info("NOTE: No public SSH key found, you will only be able to use SSH password authentication!") +def setup_keymap(args): + """ + Set the keymap with the setup-keymap utility if the device requires it + """ + suffix = "rootfs_" + args.device + info = pmb.parse.deviceinfo(args, device=args.device) + if "keymaps" not in info or info["keymaps"].strip() == "": + logging.info("NOTE: No valid keymap specified for device") + return + options = info["keymaps"].split(' ') + if (args.keymap != "" and + args.keymap is not None and + args.keymap in options): + layout, variant = args.keymap.split("/") + pmb.chroot.root(args, ["setup-keymap", layout, variant], suffix, log=False) + else: + logging.info("NOTE: No valid keymap specified for device") + + def install(args): # Install required programs in native chroot logging.info("*** (1/5) PREPARE NATIVE CHROOT ***") @@ -169,6 +187,9 @@ def install(args): # Set the user password set_user_password(args) + # Set the keymap if the device requires it + setup_keymap(args) + # Partition and fill image/sdcard logging.info("*** (3/5) PREPARE INSTALL BLOCKDEVICE ***") pmb.chroot.shutdown(args, True)