Opened 11 years ago
Closed 11 years ago
#3233 closed defect (fixed)
Typing Turtle does not recognize different keyboards
Reported by: | godiard | Owned by: | manuq |
---|---|---|---|
Priority: | Unspecified by Maintainer | Milestone: | Unspecified |
Component: | TypingTurtle | Version: | Unspecified |
Severity: | Unspecified | Keywords: | |
Cc: | Distribution/OS: | Unspecified | |
Bug Status: | Unconfirmed |
Description
Typing Turtle draw the membrane keyboard, not the mechanical.
To solve this bug is needed:
1) Identify what keyboard is in the XO, mechanical or membrane
(in new images /proc/device-tree/mfg-data/KM)
2) Prepare the definition of the mechanical keyboard. There are information about layouts in http://wiki.laptop.org/go/Keyboard_layouts
There are a utility keybuilder.py, apparently useful to scan key codes. In keyboard.py is the definition of size and position of the keys.
This bug was reported in http://dev.laptop.org/ticket/11456
Attachments (1)
Change History (10)
comment:1 Changed 11 years ago by godiard
comment:2 Changed 11 years ago by manuq
This is my solution for part 1:
KEYBOARD_MODEL_PATHS = [ '/ofw/mfg-data/KM', # XO-1, XO-1.5 '/proc/device-tree/mfg-data/KM', # XO-1.75 ] def is_membrane(): """Check via the filesystem if the keyboard is non-membrane. Keyboard code is 'olpcm' for non-membrane, mechanical keyboard, and 'olpc' for membrane keyboard. """ result = True def get_keyboard_model_code(f): """Return the code in the file, remove the last character.""" return open(f).read()[:-1] for test_path in KEYBOARD_MODEL_PATHS: if os.path.exists(test_path): code = get_keyboard_model_code(test_path) if code == 'olpcm': result = False break return result
comment:3 Changed 11 years ago by manuq
While doing part 2, I come into account that I will also need to make new hand graphics, to place the fingertips in the keys.
comment:4 follow-up: ↓ 5 Changed 11 years ago by martin.langhoff
Hi Manuel - thanks for looking into this. I don't think reading KM is the right path, if you look inside olpc-configure, you'll see the rules around keyboard models are complicated. You should instead query setxbkmap, or read from /etc/sysconfig/keyboard
comment:5 in reply to: ↑ 4 Changed 11 years ago by godiard
Replying to martin.langhoff:
Hi Manuel - thanks for looking into this. I don't think reading KM is the right path, if you look inside olpc-configure, you'll see the rules around keyboard models are complicated. You should instead query setxbkmap, or read from /etc/sysconfig/keyboard
But this code is only to identify, if is a mechanical or a membrane keyboard, the layout is already defined in another place.
comment:6 Changed 11 years ago by manuq
Thanks Martin, then I should call a command like this via Python:
setxkbmap -query | grep model
and check "model: olpc" or "model: olpcm" in the output.
comment:7 Changed 11 years ago by manuq
Gonzalo, I think this way is better because it doesn't depend on the location of KM file, is in different places in XO-1.5 and XO-1.75 .
comment:8 Changed 11 years ago by manuq
Part I, reloaded:
def _is_olpcm_model(): """Check via setxkbmap if the keyboard model is olpcm. Keyboard model code is 'olpcm' for non-membrane, mechanical keyboard, and 'olpc' for membrane keyboard. """ code = None p = subprocess.Popen(["setxkbmap", "-query"], stdout=subprocess.PIPE) out, err = p.communicate() for line in out.splitlines(): if line.startswith('model:'): code = line.split()[1] return code == 'olpcm'
Part II on the way.
Changed 11 years ago by manuq
comment:9 Changed 11 years ago by godiard
- Resolution set to fixed
- Status changed from new to closed
Thanks Manuq. Included in Typing Turtle 29
More information about keyboard configurations: http://wiki.laptop.org/go/Manufacturing_data#Keyboards