these are my adventures on connecting bluetooth keyboard to jolla sailfish device.

first of all, the keyboard would not connect. manual says just ‘press the connect button and let them pair’, but devices were not able to connect. i have tried to type ‘1234’ on a keyboard and press enter, then sailfish asked me for a password, i typed ‘1234’ and again got the message indicating that device is not paired. then i repeated the same with ‘0000’ and somehow, the device works.

now, how would i use my favourite programmers dvorak layout, and armenian typewriter?

it turned out i need to

so there is an utility called ckbcomp that can convert xkb layouts to kmap files:

emerge ckbcomp

ckbcomp -keycodes evdev -layout us -variant dvp > /tmp/usdvp.kmap
ckbcomp -keycodes evdev -layout am > /tmp/am.kmap

now, i was searching for kmap2qmap utility, but apparently it absent in all linux distributions. so, my qt version on my laptop is 5.9.4, so i went to qt site, and downloaded version of qttools source for that version.


well, these was not as easy, it took me a lot of time to understand that i need to compile the source, where to get it, etc. i also tried to install it on sailfish, but there was a problem:

[root@Sailfish keymaps]# pkcon --allow-downgrade install qt5-qttools-kmap2qmap  
Testing changes                                                                 
Finished                                       [                      ] (0%)  
The following packages have to be installed:
qt5-qttools-5.6.3+git1-1.4.3.armv7hl   Development tools for Qt
qt5-qttools-kmap2qmap-5.6.3+git1-1.4.3.armv7hl The kmap2qmap tool
Proceed with changes? [N/y] y

Refreshing software list
Resolving dependencies                                                         
Downloading packages                                                           
Fatal error: File './qt/armv7hl/qt5-qttools-5.6.3+git1-1.4.3.armv7hl.rpm' not found on medium 'https://releases.jolla.com/releases/'

[root@Sailfish keymaps]#

but from this output i guessed that i need the package called qttools to find the utility.

so, i have got the package, then:

tar Jxvf qttools-opensource-src-5.9.4.tar.xz

found the source directory with find, and went there:

cd src/kmap2qmap/

now there is a .pro file, and .cpp file, how do i compile them?

i just tried qmake and make, and it worked!

noch@aygepar /tmp/qttools-opensource-src-5.9.4/src/kmap2qmap $ qmake
Info: creating stash file /tmp/qttools-opensource-src-5.9.4/.qmake.stash
noch@aygepar /tmp/qttools-opensource-src-5.9.4/src/kmap2qmap $ ls
kmap2qmap.pro  main.cpp  Makefile  target_wrapper.sh
noch@aygepar /tmp/qttools-opensource-src-5.9.4/src/kmap2qmap $ make
x86_64-pc-linux-gnu-g++ -c -O2 -march=native -pipe -std=c++1z -fno-exceptions -Wall -W -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -D_REENTRANT -fPIC -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_INPUT_SUPPORT_LIB -DQT_DEVICEDISCOVERY_SUPPORT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtInputSupport -isystem /usr/include/qt5/QtInputSupport/5.9.4 -isystem /usr/include/qt5/QtInputSupport/5.9.4/QtInputSupport -isystem /usr/include/qt5/QtGui/5.9.4 -isystem /usr/include/qt5/QtGui/5.9.4/QtGui -isystem /usr/include/qt5/QtDeviceDiscoverySupport -isystem /usr/include/qt5/QtDeviceDiscoverySupport/5.9.4 -isystem /usr/include/qt5/QtDeviceDiscoverySupport/5.9.4/QtDeviceDiscoverySupport -isystem /usr/include/qt5/QtCore/5.9.4 -isystem /usr/include/qt5/QtCore/5.9.4/QtCore -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -I.moc -isystem /usr/include/libdrm -I/usr/lib64/qt5/mkspecs/linux-g++ -o .obj/main.o main.cpp
x86_64-pc-linux-gnu-g++ -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,--gc-sections -Wl,--enable-new-dtags -o ../../bin/kmap2qmap .obj/main.o   -lQt5InputSupport -lmtdev -linput -lxkbcommon -lQt5DeviceDiscoverySupport -ludev -lQt5Gui -lQt5Core -lGL -lpthread

now, ls does not show the compiled binary

noch@aygepar /tmp/qttools-opensource-src-5.9.4/src/kmap2qmap $ ls
kmap2qmap.pro  main.cpp  Makefile  target_wrapper.sh

where do i find it? what if i try to install it?

/usr/lib64/qt5/bin/qmake -install qinstall -exe ../../bin/kmap2qmap /usr/lib64/qt5/bin/kmap2qmap
Error copying ../../bin/kmap2qmap to /usr/lib64/qt5/bin/kmap2qmap: Cannot create /usr/lib64/qt5/bin/kmap2qmap for output
Makefile:348: recipe for target 'install_target' failed
make: [install_target] Error 3 (ignored)
(reverse-i-search)`wget': ^Cet https://download.qt.io/archive/qt/5.9/5.9.4/submodules/qttools-opensource-src-5.9.4.tar.xz

this failed, but aha, there it is. at ../../bin directory.

cd ../../bin
cp kmap2qmap /home/noch/test

I also put my usdvp.kmap and am.kmap files there. now generating qmap file

./kmap2qmap usdvp.kmap am.kmap noch.qmap

copy it to jolla device:

scp noch.qmap root@

now on jolla i had to backup the existing boston.qmap file, and replace it with my file.

cd /usr/share/qt5/keymaps/
cp boston.qmap boston_.qmap
cp noch.qmap boston.qmap

how do i now change the settings menu to indicate the change?

apparently, by editing /usr/share/jolla-settings/pages/text_input/textinput.qml file.

I have added there

ListElement {
layout: "am"
name: "Armenian"
ListElement {
layout: "us(dvp)"
name: "Dvorak"

reboot, and now it works!

well, there is a problem, that if the bt keyboard is on, then the login screen of jolla requires you to use hardware keyboard to login, not the screen keyboard. so i turn off the bt keyboard during restart.

also, make sure you have wifi connection via ssh to the device in case something goes wrong, you would need to login to device and change things. #jolla #sailfish #keyboard #bluetooth #layout #dvorak #armenian

բնօրինակ սփիւռքում(եւ մեկնաբանութիւննե՞ր)

պիտակներ՝     jolla  sailfish  keyboard  bluetooth  layout  dvorak  armenian