Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Konami Keyboard for Beatmania DaDaDa #47

Open
seta-san opened this issue Aug 19, 2020 · 10 comments
Open

Konami Keyboard for Beatmania DaDaDa #47

seta-san opened this issue Aug 19, 2020 · 10 comments

Comments

@seta-san
Copy link

=========================== USB Port5 ===========================

Connection Status : 0x01 (Device is connected)
Port Chain : 2-5
Properties : 0x01
IsUserConnectable : yes
PortIsDebugCapable : no
PortHasMultiCompanions : no
PortConnectorIsTypeC : no
ConnectionIndex : 5

  ======================== USB Device ========================

    +++++++++++++++++ Device Information ++++++++++++++++++

Device Description : USB Input Device
Device Path : \?\USB#VID_0510&PID_0002#5&20eff38c&0&5#{a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)
Kernel Name : \Device\USBPDO-11
Device ID : USB\VID_0510&PID_0002\5&20EFF38C&0&5
Hardware IDs : USB\VID_0510&PID_0002&REV_0020 USB\VID_0510&PID_0002
Driver KeyName : {745a17a0-74d3-11d0-b6fe-00a0c90f57da}\0017 (GUID_DEVCLASS_HIDCLASS)
Driver : \SystemRoot\System32\drivers\hidusb.sys (Version: 10.0.19041.1 Date: 2019-12-07)
Driver Inf : C:\WINDOWS\inf\input.inf
Legacy BusType : PNPBus
Class : HIDClass
Class GUID : {745a17a0-74d3-11d0-b6fe-00a0c90f57da} (GUID_DEVCLASS_HIDCLASS)
Service : HidUsb
Enumerator : USB
Location Info : Port_#0005.Hub_#0003
Location IDs : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(5), ACPI(SB)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS05)
Container ID : {4771d702-e0c2-11ea-b4aa-98588a040f8f}
Manufacturer Info : (Standard system devices)
Capabilities : 0x84 (Removable, SurpriseRemovalOK)
Status : 0x0180400A (DN_DRIVER_LOADED, DN_STARTED, DN_REMOVABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
Problem Code : 0
HcDisableSelectiveSuspend: 0
EnableSelectiveSuspend : 0
SelectiveSuspendEnabled : 0
EnhancedPowerMgmtEnabled : 1
IdleInWorkingState : 0
WakeFromSleepState : 0
Power State : D0 (supported: D0, D1, D2, D3, wake from D0, wake from D1, wake from D2)
Child Device 1 : HID Keyboard Device
Device Path 1 : \?\HID#VID_0510&PID_0002#6&380ae972&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd} (GUID_DEVINTERFACE_KEYBOARD)
Device Path 2 : \?\HID#VID_0510&PID_0002#6&380ae972&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd (GUID_DEVINTERFACE_HID)
Kernel Name : \Device\000000be
Device ID : HID\VID_0510&PID_0002\6&380AE972&0&0000
Class : Keyboard
Driver KeyName : {4d36e96b-e325-11ce-bfc1-08002be10318}\0002 (GUID_DEVCLASS_KEYBOARD)
Service : kbdhid

    ---------------- Connection Information ---------------

Connection Index : 0x05 (5)
Connection Status : 0x01 (DeviceConnected)
Current Config Value : 0x01
Device Address : 0x10 (16)
Is Hub : 0x00 (no)
Device Bus Speed : 0x00 (Low-Speed)
Number Of Open Pipes : 0x01 (1 pipe to data endpoints)
Pipe[0] : EndpointID=1 Direction=IN ScheduleOffset=0 Type=Interrupt
Data (HexDump) : 05 00 00 00 12 01 10 01 00 00 00 08 10 05 02 00 ................
20 00 01 02 00 01 01 00 00 10 00 01 00 00 00 01 ...............
00 00 00 07 05 81 03 08 00 0A 00 00 00 00 ..............

    --------------- Connection Information V2 -------------

Connection Index : 0x05 (5)
Length : 0x10 (16 bytes)
SupportedUsbProtocols : 0x03
Usb110 : 1 (yes)
Usb200 : 1 (yes)
Usb300 : 0 (no)
ReservedMBZ : 0x00
Flags : 0x00
DevIsOpAtSsOrHigher : 0 (Is not operating at SuperSpeed or higher)
DevIsSsCapOrHigher : 0 (Is not SuperSpeed capable or higher)
DevIsOpAtSsPlusOrHigher : 0 (Is not operating at SuperSpeedPlus or higher)
DevIsSsPlusCapOrHigher : 0 (Is not SuperSpeedPlus capable or higher)
ReservedMBZ : 0x00
Data (HexDump) : 05 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 ................

---------------------- Device Descriptor ----------------------

bLength : 0x12 (18 bytes)
bDescriptorType : 0x01 (Device Descriptor)
bcdUSB : 0x110 (USB Version 1.10)
bDeviceClass : 0x00 (defined by the interface descriptors)
bDeviceSubClass : 0x00
bDeviceProtocol : 0x00
bMaxPacketSize0 : 0x08 (8 bytes)
idVendor : 0x0510 (Sejin Electron Inc.)
idProduct : 0x0002
bcdDevice : 0x0020
iManufacturer : 0x01 (String Descriptor 1)
Language 0x0409 : "KONAMI CPJ1"
iProduct : 0x02 (String Descriptor 2)
Language 0x0409 : "USB JIS Mini Keyboard"
iSerialNumber : 0x00 (No String Descriptor)
bNumConfigurations : 0x01 (1 Configuration)
Data (HexDump) : 12 01 10 01 00 00 00 08 10 05 02 00 20 00 01 02 ............ ...
00 01 ..

------------------ Configuration Descriptor -------------------

bLength : 0x09 (9 bytes)
bDescriptorType : 0x02 (Configuration Descriptor)
wTotalLength : 0x0022 (34 bytes)
bNumInterfaces : 0x01 (1 Interface)
bConfigurationValue : 0x01 (Configuration 1)
iConfiguration : 0x02 (String Descriptor 2)
Language 0x0409 : "USB JIS Mini Keyboard"
bmAttributes : 0xA0
D7: Reserved, set 1 : 0x01
D6: Self Powered : 0x00 (no)
D5: Remote Wakeup : 0x01 (yes)
D4..0: Reserved, set 0 : 0x00
MaxPower : 0x14 (40 mA)
Data (HexDump) : 09 02 22 00 01 01 02 A0 14 09 04 00 00 01 03 01 ..".............
01 00 09 21 10 01 0F 01 22 44 00 07 05 81 03 08 ...!...."D......
00 0A ..

    ---------------- Interface Descriptor -----------------

bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x00
bAlternateSetting : 0x00
bNumEndpoints : 0x01 (1 Endpoint)
bInterfaceClass : 0x03 (HID - Human Interface Device)
bInterfaceSubClass : 0x01 (Boot Interface)
bInterfaceProtocol : 0x01 (Keyboard)
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 00 00 01 03 01 01 00 .........

    ------------------- HID Descriptor --------------------

bLength : 0x09 (9 bytes)
bDescriptorType : 0x21 (HID Descriptor)
bcdHID : 0x0110 (HID Version 1.10)
bCountryCode : 0x0F (15 = Japan (Katakana))
bNumDescriptors : 0x01
Data (HexDump) : 09 21 10 01 0F 01 22 44 00 .!...."D.
Descriptor 1:
bDescriptorType : 0x22 (Class=Report)
wDescriptorLength : 0x0044 (68 bytes)
Error reading descriptor : ERROR_INVALID_PARAMETER

    ----------------- Endpoint Descriptor -----------------

bLength : 0x07 (7 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x81 (Direction=IN EndpointID=1)
bmAttributes : 0x03 (TransferType=Interrupt)
wMaxPacketSize : 0x0008
bInterval : 0x0A (10 ms)
Data (HexDump) : 07 05 81 03 08 00 0A .......

  -------------------- String Descriptors -------------------
         ------ String Descriptor 0 ------

bLength : 0x04 (4 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language ID[0] : 0x0409 (English - United States)
Data (HexDump) : 04 03 09 04 ....
------ String Descriptor 1 ------
bLength : 0x18 (24 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "KONAMI CPJ1"
Data (HexDump) : 18 03 4B 00 4F 00 4E 00 41 00 4D 00 49 00 20 00 ..K.O.N.A.M.I. .
43 00 50 00 4A 00 31 00 C.P.J.1.
------ String Descriptor 2 ------
bLength : 0x2C (44 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "USB JIS Mini Keyboard"
Data (HexDump) : 2C 03 55 00 53 00 42 00 20 00 4A 00 49 00 53 00 ,.U.S.B. .J.I.S.
20 00 4D 00 69 00 6E 00 69 00 20 00 4B 00 65 00 .M.i.n.i. .K.e.
79 00 62 00 6F 00 61 00 72 00 64 00 y.b.o.a.r.d.

@Florin9doi
Copy link
Contributor

Florin9doi commented Aug 19, 2020

You should use linux to analyze such devices because a significant part is missing (Error reading descriptor : ERROR_INVALID_PARAMETER).
Additional to initial descriptions, the subsequent packets should be understood also. Sometimes they may be guesses analyzing the descriptors, but having examples always helps. Eg: the button "A" sends 0x00,0x05, the button "R" sends 0x00,0x33...
Can you use this keyboard on a PC? Everything works? Do you have any good picture? Google finds only low quality images took last century.

@seta-san
Copy link
Author

How do I inspect it on linux?

@Florin9doi
Copy link
Contributor

Florin9doi commented Aug 20, 2020

Run the following command, re/connect the device, wait a few seconds and then press Ctrl+C:
sudo dmesg -c > /dev/null && sudo dmesg -w

While the device is connected:
find /sys/devices/ -name *descriptor* -type f -exec echo {} \; -exec hexdump {} -C \;
sudo lsusb -v -d 0510:0002
sudo usbhid-dump --entity=d --model=0510:0002

To dump hid packets run the following command, then press one button noting both the button pressed and the output:
sudo usbhid-dump --entity=s --model=0510:0002
For a keyboard, they should be sequential so having the output for F1,F2 and F12, we can deduce the values for F3 to F11.

@jackun
Copy link
Owner

jackun commented Aug 20, 2020

Probably not needed but for sake of completeness.
image

@seta-san
Copy link
Author

Bus 002 Device 010: ID 0510:0002 Sejin Electron, Inc. USB JIS Mini Keyboard
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0510 Sejin Electron, Inc.
idProduct 0x0002
bcdDevice 0.20
iManufacturer 1 KONAMI CPJ1
iProduct 2 USB JIS Mini Keyboard
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0022
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 2 USB JIS Mini Keyboard
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 40mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 15 Japan (Katakana)
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 68
Report Descriptor: (length is 68)
Item(Global): Usage Page, data= [ 0x01 ] 1
Generic Desktop Controls
Item(Local ): Usage, data= [ 0x06 ] 6
Keyboard
Item(Main ): Collection, data= [ 0x01 ] 1
Application
Item(Global): Usage Page, data= [ 0x07 ] 7
Keyboard
Item(Local ): Usage Minimum, data= [ 0xe0 ] 224
Control Left
Item(Local ): Usage Maximum, data= [ 0xe7 ] 231
GUI Right
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x08 ] 8
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x01 ] 1
Item(Main ): Input, data= [ 0x01 ] 1
Constant Array Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Usage Page, data= [ 0x07 ] 7
Keyboard
Item(Local ): Usage Minimum, data= [ 0x00 ] 0
No Event
Item(Local ): Usage Maximum, data= [ 0xff ] 255
(null)
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x06 ] 6
Item(Main ): Input, data= [ 0x00 ] 0
Data Array Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Usage Page, data= [ 0x08 ] 8
LEDs
Item(Local ): Usage Minimum, data= [ 0x01 ] 1
NumLock
Item(Local ): Usage Maximum, data= [ 0x05 ] 5
Kana
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x05 ] 5
Item(Main ): Output, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Report Size, data= [ 0x03 ] 3
Item(Global): Report Count, data= [ 0x01 ] 1
Item(Main ): Output, data= [ 0x01 ] 1
Constant Array Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Main ): End Collection, data=none
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0002
(Bus Powered)
Remote Wakeup Enabled

@seta-san
Copy link
Author

/sys/devices/pci0000:00/0000:00:14.0/usb2/2-5/2-5:1.0/0003:0510:0002.000A/report_descriptor
00000000 05 01 09 06 a1 01 05 07 19 e0 29 e7 15 00 25 01 |..........)...%.|
00000010 75 01 95 08 81 02 75 08 95 01 81 01 05 07 19 00 |u.....u.........|
00000020 29 ff 15 00 26 ff 00 75 08 95 06 81 00 05 08 19 |)...&..u........|
00000030 01 29 05 15 00 25 01 75 01 95 05 91 02 75 03 95 |.)...%.u.....u..|
00000040 01 91 01 c0 |....|
00000044

@seta-san
Copy link
Author

[manjaro manjaro]# sudo usbhid-dump --entity=d --model=0510:0002
002:011:000:DESCRIPTOR 1597890235.235938
05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01
75 01 95 08 81 02 75 08 95 01 81 01 05 07 19 00
29 FF 15 00 26 FF 00 75 08 95 06 81 00 05 08 19
01 29 05 15 00 25 01 75 01 95 05 91 02 75 03 95
01 91 01 C0

@jackun
Copy link
Owner

jackun commented Aug 20, 2020

I guess at least on linux with evdev it seems to (mostly) work 463286f

Now the annoying part would be how to block PCSX2 UI from ignoring acknowledging key presses.

ASDF/JKL only stage also registers U as J, I as K etc, don't know if intentional or something borked.

@seta-san
Copy link
Author

20200820_031315
20200820_031310
20200820_031304
20200820_031259
20200820_031253

@seta-san
Copy link
Author

I guess at least on linux with evdev it seems to (mostly) work 463286f

Now the annoying part would be how to block PCSX2 UI from ignoring acknowledging key presses.

ASDF/JKL only stage also registers U as J, I as K etc, don't know if intentional or something borked.

My hack with the standard keyboard module worked fine except the escape button

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

No branches or pull requests

3 participants