This is an old revision of the document!
Connecting a keyboard
In order to set up your keyboard for use in Folk you need to create a keyboard claim like this (taken from the folk0 instance):
Claim $this is a keyboard with path /dev/input/by-path/platform-i8042-serio-0-event-kbd
This page will walk you through creating your own keyboard claim for use in Folk.
In a virtual program paste this program:
proc udevadmProperties {device} {
return [exec udevadm info --query=property --name=$device]
}
proc findEventPath {str} {
set pattern {DEVNAME=(/dev/input/event\d+)}
set capturedMatch ""
if {[regexp -- $pattern $str allMatch capturedMatch]} {
return true
} else {
return false
}
}
proc isKeyboard {device} {
set properties [udevadmProperties $device]
if {$properties eq ""} {
return false
}
set hasEventPath [findEventPath $properties]
# Check if device is a keyboard and not a mouse
set isKeyboard [string match *ID_INPUT_KEYBOARD=1* $properties]
set isMouse [string match *ID_INPUT_MOUSE=1* $properties]
set isPCI [string match *pci-* $device]
return [expr {$isPCI && $isKeyboard && $hasEventPath}]
# return [expr {$isPCI && $isKeyboard && !$isMouse}]
}
set allDevices [glob -nocomplain /dev/input/by-path/*]
set keyboards [list]
foreach device $allDevices {
set keyboardCheck [isKeyboard $device]
set notInList [expr {[lsearch -exact $keyboards $device] == -1}]
if {$keyboardCheck && $notInList} {
lappend keyboards $device
}
}
Wish $this is outlined white
foreach kb $keyboards {
Wish $this is labelled "$kb"
puts "---\nKeyboard claim: Claim \$this is a keyboard with path $kb\n---\n"
}
When you hit save this will display the connected keyboard's path on the table:
and in the journal (make journal):
Dec 14 19:00:24 folk0 make[30201]: --- Dec 14 19:00:24 folk0 make[30201]: Keyboard claim: Claim $this is a keyboard with path /dev/input/by-path/pci-0000:02:00.0-usb-0:2:1.2-event-mouse Dec 14 19:00:24 folk0 make[30201]: ---
If no keyboards appear in the list
This is known to happen with Bluetooth keyboards. You can put it into /dev/input/by-path by adding a udev rule. Then rerun the detection program.
Put this claim into a new virtual program:
Claim $this is a keyboard with path [WHATEVER PATH YOU GOT FOR YOUR KEYBOARD]
Print this out onto card stock or thick paper so it will resist crumpling over time. Tape this to the bottom of your keyboard and you now have a keyboard (which should have an attached editor automatically):


