Fixing USB Keyboard Type

From Pterodactylus
Revision as of 19:11, 9 February 2024 by Bombe (talk | contribs) (Created page with "First, export the current keyboard settings: # defaults export /Library/Preferences/com.apple.keyboardtype keyboardtype Then, find USB vendor and product ID of your keyboar...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

First, export the current keyboard settings:

# defaults export /Library/Preferences/com.apple.keyboardtype keyboardtype

Then, find USB vendor and product ID of your keyboard:

# lsusb
Bus 000 Device 001: ID 0bda:2172 Realtek Semiconductor Corp. BillBoard Device  Serial: 00000000000000000
Bus 001 Device 001: ID 2109:0822 VIA Labs, Inc. USB3.1 Hub  Serial: 000000001
Bus 001 Device 003: ID 05e3:0626 Genesys Logic, Inc. USB3.1 Hub
Bus 001 Device 004: ID 0b95:1790 ASIX Electronics Corporation AX88179A  Serial: 00000000000001
Bus 001 Device 006: ID 2537:1081 2537 NS1081  Serial: 0123456789ABCDE
Bus 001 Device 002: ID 2109:2822 VIA Labs, Inc. USB2.0 Hub  Serial: 000000001
Bus 001 Device 008: ID 0bda:8152 Realtek Semiconductor Corp. USB 10/100 LAN  Serial: 00E04C36001A
Bus 001 Device 007: ID 14cd:8601 MOAI ELECTRONICS CORPORATION USB 2.0 Hub
Bus 001 Device 009: ID 05e3:0610 Genesys Logic, Inc. USB2.1 Hub
Bus 001 Device 012: ID 25a7:fa61 25a7 2.4G Receiver
Bus 001 Device 011: ID 04d9:a1dd Holtek Semiconductor, Inc. USB-HID Keyboard
Bus 001 Device 010: ID 0bda:0567 Realtek Semiconductor Corp. WEB CAMERA M9 Pro  Serial: 200901010001
Bus 001 Device 005: ID 291a:8388 291a Anker USB-C Hub Device  Serial: 0000000000000001
Bus 000 Device 000: ID 0bda:2172 Realtek Semiconductor Corp. USB 3.1 Bus
Bus 000 Device 000: ID 2109:0822 VIA Labs, Inc. USB 3.1 Bus

The keyboard is the USB device 04d9:a1dd. Convert the two IDs to decimal numbers; the product ID is 41437, and the vendor ID is 1241.

Now, open the keyboardtype file, and look for entry that has your product and vendor ID in decimal:

{
    "41254-1241-0" = 40;
    "41437-1241-0" = 43;
    "41521-1241-0" = 41;
    "48879-65261-0" = 40;
    "50475-1133-0" = 41;
    "61453-65261-0" = 40;
    "64097-9639-0" = 43;
    "754-5215-0" = 43;
    "763-5215-0" = 43;
}

The number represents the type of keyboard (41 is ISO). Change the number to the type you want the keyboard to be.

Import the changed file back:

# sudo defaults import /Library/Preferences/com.apple.keyboardtype - < keyboardtype

Now unplug the keyboard and plug it back in.