Road to Kwumsy K2 mod (part 2)

youtu.be
The last step was how to put everything in the body.
This was my floor plan.

  • move the keyboard controller board to 7 o'clock direction, to accommodate custom USB-C cable connector and USB power bank
  • put USB power bank aside the keyboard control board
  • put Raspberry Pi on the keyboard controller board
  • install switch and USB charger connector to top right corner


First any conflicting bosses, pillars and supports were removed, to make sure the floor plan works.

Looking into the keyboard controller, all FFC & cables have marginal length, except touch controller FPC.
The FPC is 0.5mm pitch 6 contact.
I installed the FPC extension and long FFC.

New bosses were installed to hold the keyboard controller board.

Holes were punched and drilled to install switch and USB connector for charger.

Bosses were attached to Raspberry Pi board too.

This is finally assembly.

Power is distributed as below.

If you are interested, here are the links for 0.5mm 6 contact pitch FFC extension and FFC.
https://www.amazon.com/gp/product/B07RWNDFV1www.amazon.com
https://www.amazon.com/gp/product/B07RZ8M6M6www.amazon.com

Oh BTW - the enclosure screws are tricky, they are hex cap screws (some are trox but open-able by hex), you may need some special tool like this.
I replaced them with regular Phillips screws after all, they are M2, short ones are 4mm, long ones are 8mm.
www.amazon.com

Road to Kwumsy K2 mod (part 1)

youtu.be
I thought someone would make Handheld computer with it when I saw Kwumsy K2, full mechanical keyboard with touch screen first time.
There was a thread running on reddit too - I was expecting to see it in a month or 2.
...
well, after a year, nothing came up to the world.
Finding affordable 2nd hand one, I started my project, turning Kwumsy K2 as TRS-80 model 100 reborn.

Let's start from ingredients;

  • Kwumsy K2 keyboard + touch screen: for sure, we need it
  • Raspberry Pi Zero 2 W: this single board computer (SBC) enables linux based Raspberry Pi OS with HDMI, USB HID device and WiFi connection, very handy


Yeah, it works in dummy manner.

I plotted my build plan majorly with cable management - not to modify board, but to make custom cables to connect boards and other parts.
I bought a couple of cables and break-out boards;

  • mini-HDMI - HDMI cable: check link below, actually I bought several sorts, this is the easiest for hand-soldering
  • USB-A - micro-USB cable: anyone is fine, you must have some spares
  • micro-USB extension with chassis mount: check link below, I use it for USB power-bank charging
  • USB-C break-out board: check link below, it enables Kwumsy K2 keyboard control board - Raspberry Pi connection
  • USB-A break-out board: check link below, it is used for the board - USB power-bank connection
  • mini-HDMI break-out board: it is used for the reverse engineering and open/short check, if you are confident of your blue-wire work, you don't need it :-)

At last power management;

  • power button: anyone is fine as far as it fits into the space
  • USB power-bank (battery): I choose one in the below link, simply because of real estate


The most critical thing was to make a custom HDMI + USB -> USB-C cable in the project.
USB.org specifies USB-C HDMI alt mode, i.e. USB-C -> HDMI + USB - but the inbox cable is reverse of it, HDMI + USB -> USB-C.
Unless the inbox cable has some magic chip inside to do the magic, the inbox cable must be just a collection of wires.
I opened the inbox cable...


Yep, I am right and the cable is a dum collection of wires, all HDMI & USB are connected straight, the keyboard control board makes all the magic.


Next step was to find HDMI + USB -> USB-C "connector" pin to pin connection.
Break-out boards really help to figure out it - this is it.

If VBUS and GND are connected, Raspberry Pi can be powered from the keyboard control board.
Otherwise (my case) you can feed externally to both Raspberry Pi and the keyboard control board, as below.

To be continued - 次回もさーびすさーびすぅ!


mini HDMI - HDMI cable
www.amazon.com
micro-USB extension with chassis mount
https://www.amazon.com/dp/B09CPCLTHDwww.amazon.com
USB-A break-out board
https://www.amazon.com/dp/B0B1CGJWNHwww.amazon.com
USB-C break-out board
https://www.amazon.com/dp/B0BZVP3BV3www.amazon.com
mini-HDMI break-out board
https://www.amazon.com/dp/B0BLYT2PH6www.amazon.com
USB power-bank
www.amazon.com

Chuwi MiniBook X (N100版) USB充電再検証


こちらの記事でさらっと触れたのだが、Chuwiの製品は代々「USB-Cのプラグで充電できる、かっこいいうちの製品」をやってきていた。
付属の充電器がUSB-Cの恰好をしていながら、いきなり12Vをどっかーんとぶちかます仕様なのだ。
USB PDに関してはこちらで記事にしているが、VBUSは基本5Vで、その後にCCを通じて充電能力を交渉して最終的に何V何Aで充電するかが決まるようになっているのだ。
そこにこの充電器はいきなり12Vをどっかーんとぶちかますのだ。
5V対応しかしない機材にこいつをつなぐと間違いなく火を噴く。

充電される側、つまりPCの方も、過去の製品についてはUSB PDに対応せずに、ヒンジ側のUSB-Cポートが12Vどっかーん専用になっていた。
目印としてJEITAのセンターハイの充電プラグのマークがついている。
このヒンジ側のUSB-CポートにUSB PD充電器を繋ぐと全く充電せず、過放電で使用できなくなって泣く人続出であった。


然して。


5chの記事を読んでいると、どうもChuwi MiniBook X (N100版)では両方のUSB-Cポート共にUSB PD対応をしているようなのだ。
休暇シーズンでようやく時間もできたので再検証してみた。
最初の写真は純正の充電器、他の機種とも共用しているのだろうが、お約束通り12Vをいきなりどっかーんだ。
こいつを充電マーク(だからこれはJEITAのセンターハイの充電プラグのマークだって)のあるヒンジ側のポートに挿す。

予定通り12V、3A近くで充電している。

つぎに65W(最大20V/3A)のUSB PD充電器で充電してみる。

ヒンジ側。


電源ボタン側。
どちらも20V/最大3Aのモードで充電している。

最後に105W(最大20V/5A)のUSB PD充電器で充電してみる。

ヒンジ側。


電源ボタン側。
どちらも20V/最大3Aのモードで充電している。

他にもいろいろ試してみたのだが、USB PDからの充電は最大で20V/1.8A程度、純正充電器でも12V/3A、つまり最大36Whrでしか充電されないようだ。
しかもこの充電制御はCPUで管理されているようで、PCの電源が入っていないとUSB PDからの充電が20V/0.8Aまで落ちる、純正充電器でも12V/1.3A、つまりPCの電源が落ちてS5の状態だと最大16Whrでしか充電されないようだ。

以上結論、Chuwi MiniBook X (N100版)はどちらのポートもUSB PD対応しているけど、純正充電器で他の器具を充電しちゃだめだよ。よいこのみんな、おじさんとおやくそくだよ!

ガジェットリスト更新 - 更にこんなことになって御座候

  • iPhone 13 Pro (現地回線)
  • Surface Duo2 256GB (2nd Gen, 日本回線)
  • EOS Rp
  • EOS 7D (4年ぶり2台目)
  • Cube PC(Ryzen 7 5800X / GeForce RTX3060)
  • MacBook Pro 13" 16-2(Mid 2020 A2251, Core i5 1038NG7)
  • Chuwi MiniBook X (N100版)
  • Boox Tab Ultra
  • Lenovo Tab M10 Plus (3rd Gen, LTE版)
  • Garmin Venu 2
  • Bose Quiet Comfort 35

遂に一眼レフボデー2台持ちの沼に落ちました。

Raspberry Piのカーネルドライバ(モジュール)をWSL上でクロスコンパイル

さていよいよ今回のプロジェクトの本題、Raspbery Piをターゲットにしたlinuxカーネルドライバ(モジュール)の作成だ。
まずは安全牌でRaspbery Piでビルドしてみよう。

そう、私のRaspbery PiのカーネルはWSL上でクロスコンパイルした代物。
どうやら一筋縄ではいかないらしい。


どうせやるつもりだったので、いきなりWSL上でクロスコンパイルすることにした。
手順は

だ。
すでにWSL上でカーネルビルドをして、RaspberryPi用のソースコード・ツールチェーンが入っている前提で進める。
まだな方はこちらから。

ソースコード、ファイル名は"test.c"となっている。

#include <linux/module.h>

static int test_init(void)
{
        printk("Hello Aho Kernel Module\n");
        return 0;
}

static void test_exit(void)
{
        printk("Bye bye Aho Kernel Module\n");
}

module_init(test_init);
module_exit(test_exit);

MODULE_LICENSE("GPL");

Makefileはこんな感じ。

obj-m := test.o
KPATH := $(HOME)/source/git/linux
CROSS_COMPILE := arm-linux-gnueabihf-
ARCH := arm

all:
        make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KPATH) M=$(shell pwd) modules
clean:
        make -C $(KPATH) M=$(PWD) clean

筆者は以前にカーネルのビルドをしているので、そのディレクトリをビルド環境に指定(-C)している。
それがKPATHの" $(HOME)/source/git/linux"だ。

  • make

makeしろぷりーず。
無事に終われば、test.koができているはず。

  • デプロイ

Raspberry Piにtest.koをコピーして

sudo insmod test.ko

でドライバのロードが完了。
ドライバをカーネルからアンロードするには

sudo rmmod test.ko

上記のtest.cはロード時とアンロード時にカーネルメッセージを出力するだけの"Hello World"的なドライバなので、カーネルメッセージ(dmseg)を出力すれば、ログで確認できる。