Skip to content
This repository has been archived by the owner on Feb 20, 2025. It is now read-only.

write error trying to configure for colemak scancode #190

Open
cdaringe opened this issue Oct 24, 2024 · 1 comment
Open

write error trying to configure for colemak scancode #190

cdaringe opened this issue Oct 24, 2024 · 1 comment

Comments

@cdaringe
Copy link

problem

$ ykpersonalize -S06050708090a0b0c0d0e0f111718191a86858788898a8b8c8d8e8f919798999a271e1f202122232425269e2b28 -v
Firmware version 5.4.3 Touch level 773 Program sequence 1
Serial number : xyzxyzxyz

A new scanmap will be written.

Commit? (y/n) [n]: y
Attempting to write configuration to the yubikey... failure
Yubikey core error: write error

discussion

I've tried ykman as well, but there's no actual options for setting this. I tried specifying -D<SERIAL?> but -D only likes to roll solo.

Further https://support.yubico.com/hc/en-us/articles/5093789359516-Using-YubiKeys-with-Various-Keyboard-Layouts suggests that the -S should be 45 bytes. However, there scanmap is 44 chars, and 44 char 1-byte codes would be 44 bytes.

Please kindly advise. Switching keyboard layouts as someone who cannot type on qwerty and needs to link up to other people's periphs regularly is challenging.

@cdaringe
Copy link
Author

for those interested, here's my (maybe correct? i dunno) scanmap generator:

const alphabet = 'cbdefghijklnrtuvCBDEFGHIJKLNRTUV0123456789' // \t\r';
const alphabetColemak = 'cbsftdhuneikpglvCBSFTDHUNEIKPGLV0123456789'
// cbsftdhuneikpglvCBSFTDHUNEIKPGLV
const trSuffix = '9e2b28'; // because 45 bytes not 44?

const scanCodes = {
    'c': '06',
    'b': '05',
    'd': '07',
    'e': '08',
    'f': '09',
    'g': '0a',
    'h': '0b',
    'i': '0c',
    'j': '0d',
    'k': '0e',
    'l': '0f',
    'n': '11',
    'r': '17',
    't': '18',
    'u': '19',
    'v': '1a',
    'C': '86',
    'B': '85',
    'D': '87',
    'E': '88',
    'F': '89',
    'G': '8a',
    'H': '8b',
    'I': '8c',
    'J': '8d',
    'K': '8e',
    'L': '8f',
    'N': '91',
    'R': '97',
    'T': '98',
    'U': '99',
    'V': '9a',
    '0': '27',
    '1': '1e',
    '2': '1f',
    '3': '20',
    '4': '21',
    '5': '22',
    '6': '23',
    '7': '24',
    '8': '25',
    '9': '26',
};

function generateScanmap() {
    const basemap = alphabetColemak.split('').map((_, colemakIndex) => {
        const char = alphabet[colemakIndex];
        const byte = scanCodes[char];
        if (!byte) throw new Error('kaboom!');
        return byte;
    }).join('')
    const final = basemap + trSuffix;
    console.log(final.length / 2);
    return final;
}

const scanmap = generateScanmap();
console.log(`ykpersonalize -S${scanmap}`);
// console.log('06050708090a0b0c0d0e0f111517181986858788898a8b8c8d8e8f9195979899271e1f202122232425269e2b28')

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant