use the rkb1 specific protocol

This commit is contained in:
Charlotte 🦝 Delenk 2022-07-27 20:19:32 +01:00
parent 7c7ceeb1e6
commit 06ed7f5db7
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
3 changed files with 21 additions and 831 deletions

121
README.md
View file

@ -1,120 +1 @@
# The Plover HID protocol
## Background
Currently most hobbyist steno machines use either the TXBolt protocol or the
GeminiPR protocol, which are serial protocols running over USB CDC. The main
reason why many end users want to use the steno protocols instead of just
having their machines act like keyboards is that they don't want to
enable/disable plover all the time to be able to use their keyboards.
However there are certain issues with those protocols:
1. There is no serial profile for BLE, so any bluetooth low energy device would
need a custom protocol (GATT Service).
2. GeminiPR and TXBolt only send complete chords to the host, this makes us
lose information that could be used on the plover side to easily implement
features such as first-up chord send or auto-repeat of chords.
3. TXBolt and GeminiPR define a very restricted amount of keys. This isn't an
issue for English Stenotype, but makes it so that something like a velotype
machine won't be able to use those protocols.
4. Plover handles serial disconnects pretty badly, causing the user to have to
reconfigure their serial port in settings. This is not a big issue but has
led to some user confusion in the plover discord server.
5. There has been talk about creating hobbyist machines supporting variable
key-pressure/lever-pressure. Many professional machines have configurable
per-key pressure settings, but we could also design a protocol to send the
key pressure and handling the configuration on the plover side.
## Using HID
Arguably stenography input is Human Input, so making a steno machine a human
input device would make sense. The pros of using HID are that it's supported
both over USB, and also over BLE. By sending each state change instead of
whole chords we allow for having features like first up chord send and auto
repeat in plover. In the best of worlds we would have been able to just choose
a good HID page for steno, but unfortunately no such standard page exists.
So instead we choose a vendor-defined page, and choose a usage code that no one
else seems to use. It would of course be nice if this could be standardized in
the future, but that is probably out of reach for the amateur steno community.
It would also have been nice to just define the usage page and usage, and allow
the device itself to decide how its reports should be sent (how many buttons it
has, if it has pressure information, and so on), and then parse the hid
descriptor on the plover side. Unfortunately there isn't a good platform
independent way to retreive the HID descriptors from a device.
Instead we choose an approach where the Usage Page and Usage uniquely define a report
format that we call the "simple report format" consisting of a bitmap of 64 bits each
encoding if a certain key/lever is pressed or not.
## The HID Descriptor
```
{
0x06, 0x50, 0xff, // UsagePage (65360)
0x0a, 0x56, 0x4c, // Usage (19542)
0xa1, 0x02, // Collection (Logical)
0x85, 0x50, // ReportID (80)
0x25, 0x01, // LogicalMaximum (1)
0x75, 0x01, // ReportSize (1)
0x95, 0x40, // ReportCount (64)
0x05, 0x0a, // UsagePage (ordinal)
0x19, 0x00, // UsageMinimum (Ordinal(0))
0x29, 0x3f, // UsageMaximum (Ordinal(63))
0x81, 0x02, // Input (Variable)
0xc0, // EndCollection
}
```
Where the first byte of the Usage Page is 0xff (vendor-defined) and the second
byte is "S" and the usage bytes are "TN", together encoding the string "STN".
Due to the fact that we can't get the report descriptors in a platform-independent way
we fix the ReportID to 80 (0x50) so that we can distinguish the reports of devices sending
multiple reports on the same endpoint.
The descriptor was generated by the [HID Report Descriptor Compiler](https://github.com/nipo/hrdc) from the following python code:
```
from hrdc.usage import *
from hrdc.descriptor import *
usage = Usage('vendor-defined', 0xff504c56)
stenomachine = Collection(Collection.Logical, usage,
Report(0x50, *(Value(Value.Input, ordinal.Ordinal(x), 1, logicalMin=0, logicalMax=1) for x in range(64))))
if __name__ == '__main__':
compile_main(stenomachine)
```
A previous version of the protocol used the `Button` usage instead of the `Ordinal` usage. But linux HID stack also parsed those
as mouse-button pressed over BLE, while it didn't do so over USB. Even though this is probably a linux bug it's easier for us
to change the usage to one where that doesn't happen.
## The keys
For historical reasons we reuse the names of the standard steno keys, but we add extra keys so that we reach 64 keys in total.
The keys are ordered as follows:
```
S- T- K- P- W- H- R- A- O- * -E -U -F -R -P -B -L -G -T -S -D -Z #
```
and are then followed by key `X1-X26`
So the first bit/byte of the report (after the report type byte) maps to key
`S-` and the last bit/byte of the report maps to `X26`.
## Sample Firmware
Sample firmware for the georgi is included in this repository. It defines a default keymap of the form:
```
X1 S1- T- P- H- *1 *3 -F -P -L -T -D
X2 S2- K- W- R- *2 *4 -R -B -G -S -Z
# A O E U #
```
Sample firmware for the uni (both the pro micro and the usb-c versions) are also included. The keymap is the same as above
except for the X-keys.
## Future Work
- [x] Implement this protocol for QMK.
- [x] Implement this protocol for ZMK.
- [ ] Create a Usage Page/Usage for lever machines sending variable lever pressure.
- [ ] Look into using Output Reports for sending things to the steno machine from plover.
Forked from https://github.com/dnaq/plover-machine-hid/blob/main/plover_machine_hid.py

View file

@ -1,687 +0,0 @@
:100000000C9437010C947E010C947E010C947E01BB
:100010000C947E010C947E010C947E010C947E0164
:100020000C947E010C947E010C9414120C94D0114B
:100030000C940F130C947E010C947E010C947E01A1
:100040000C947E010C947E010C947E010C947E0134
:100050000C947E010C94EB120C947E010C947E01A6
:100060000C947E010C947E010C947E010C947E0114
:100070000C947E010C947E010C947E010C947E0104
:100080000C947E010C947E010C947E010C947E01F4
:100090000C947E010C947E010C947E010C947E01E4
:1000A0000C947E010C947E010C947E010000525A47
:1000B0005E5A685A0000535A5F5A675A0000545AF1
:1000C000605A465A0000555A615A00000000565ABC
:1000D000625A00000000575A635A000000000000F6
:1000E000000000000000515A5D5A665A0000505A44
:1000F0005C5A655A00004F5A5B5A405A00004E5AEB
:100100005A5A000000004D5A595A000000004C5A3B
:10011000585A000000000000000000000650FF0ACE
:10012000564CA1028550250175019540050A19001C
:10013000293F8102C005010906A1018501050719B2
:10014000E029E715002501950875018102950175E3
:100150000881010507190029FF150026FF009506F3
:100160007508810005081901290595057501910299
:10017000950175039101C005010980A1018503194D
:10018000012AB700150126B700950175108100C03E
:10019000050C0901A101850419012AA002150126F7
:1001A000A002950175108100C005010906A1018515
:1001B00005050719E029E715002501950875018156
:1001C000020507190029EF1500250195F075018139
:1001D000020508190129059505750191029501751A
:1001E000039101C009023B00020100A0FA090400CA
:1001F00000010301010009211101000122AF0007E4
:1002000005830320000A090401000103000000091E
:1002100021110100012219000705810320000112AC
:1002200001000200000008EDFE371301000102008A
:10023000010E03470065006F00720067006900004F
:100240000026036700200048006500610076007901
:1002500000200049006E0064007500730074007295
:100260000069006500730000000403090400112404
:100270001FBECFEFDAE0DEBFCDBF04B603FE27C05E
:100280008091420290914302A0914402B0914502B4
:100290008730904BA740B04BD1F41092420210929D
:1002A0004302109244021092450214BE84B7877F25
:1002B00084BF0FB6F894A895809160008861809300
:1002C0006000109260000FBEE0E0F8E3099511E0D5
:1002D000A0E0B1E0E8E8FAE202C005900D92A8348F
:1002E000B107D9F722E0A8E4B1E001C01D92A23421
:1002F000B207E1F70E9436130C9438150C940000F5
:10030000E8EDF0E080818E7F80831092E200109211
:10031000DA001092E100A0EEB0E08C9181608C9345
:1003200080818F77808319BCA7EDB0E08C918E7FA0
:100330008C9380818F7E808310921002089520918B
:10034000E4003091E50095E6A9012091EC00822FB0
:10035000817020FF06C08091E80080FF06C080E029
:1003600008952091E80022FD1AC08091350288236B
:1003700089F0853089F08091EB0085FD0FC02091D8
:10038000E4003091E50042175307F9F29150E1F68D
:1003900084E0089582E0089583E0089581E008955F
:1003A000EF92FF920F931F93CF937C018B010E94DA
:1003B0009F01C82F811117C08091E80085FD0BC0F7
:1003C0008091E8008E778093E8000E949F01882347
:1003D00099F3C82F08C0F70181917F018093F10044
:1003E0000150110949F78C2FCF911F910F91FF9068
:1003F000EF9008958091370287FF13C08091E80045
:1004000082FF06C08091E8008B778093E80004C0EB
:10041000809135028111F2CF0895809135028823B1
:10042000D9F38091E80080FFF8CF8091E8008E77C3
:10043000ECCF982F9093E900242F762F50E0891766
:1004400031F07091EC002091ED005091F00021FD11
:1004500007C09F5F973071F78093E90081E00895AE
:100460003091EB003E7F3093EB003091ED003D7F0B
:100470003093ED003091EB0031603093EB007093DE
:10048000EC002093ED005093F0002091EE0027FD4A
:10049000E0CF80E00895CF92DF92EF92FF920F932A
:1004A0001F93CF93DF93C8EDD0E088818F7E888340
:1004B000E7EDF0E080818160808384E082BF81E0AD
:1004C0008093100288818E7F888302EE10E0F8010D
:1004D00010821092DA0081EEC82ED12CF601108223
:1004E00088818F77888388818068888388818F7DE1
:1004F000888319BC10923502109236021092340291
:100500001092330290EEE92EF12CF70180818B7F5F
:10051000808388818160888342E060E080E00E947F
:100520001902F60180818E7F8083F80180818160CD
:100530008083808188608083F70180818E7F8083C3
:10054000888180618883DF91CF911F910F91FF9007
:10055000EF90DF90CF900895FC0180913D02909143
:100560003E0286179707A0F06115710529F4909156
:10057000E8009E779093E80090E06115710551F4D2
:10058000911108C08091E80082FF34C080E0089596
:10059000BC01F2CF809135028823C1F18530C1F1D1
:1005A0008091E80083FD30C08091E80082FDEACFB1
:1005B0008091E80080FFE1CF8091F3002091F2006C
:1005C000382F6115710519F02830310558F091E088
:1005D0002830310509F090E02091E8002E77209333
:1005E000E800CBCF81918093F100615071092F5FBA
:1005F0003F4FE7CF80913502882341F0853041F0AD
:100600008091E80083FFBECF81E0089582E00895E5
:1006100083E0089508958091120208959C014FB7D8
:10062000F8948091070290910802A0910902B0917C
:100630000A024FBF821B930B08952FB7F894809145
:10064000070290910802A0910902B0910A022FBFFF
:100650000895DF92EF92FF920F931F93CF93DF9352
:10066000F82E0E941D038C0184EAE82E94E8D92E0E
:100670001092BC00E092BC000E941D03EC0180912E
:10068000BC0087FF0DC08091B900887F8830F9F0E9
:100690008091B900887F8031D1F0CFEFDFEF08C0C3
:1006A0000E941D038C1B9D0BC29748F3CEEFDFEF1A
:1006B000C8010E940E03883E9340D0F2CE01DF9124
:1006C000CF911F910F91FF90EF90DF900895F092DE
:1006D000BB00D092BC000E941D03EC018091BC00C5
:1006E00087FF0AC08091B900887F883111F080347B
:1006F000A1F6D0E0C0E0E2CF0E941D038C1B9D0B51
:10070000C29760F3D3CFCF93DF938093BB0084E88D
:100710008093BC000E941D03EC018091BC0087FF08
:100720000FC02091B900287F81E090E0283211F4B9
:1007300090E080E0919581959109DF91CF910895A6
:100740000E941D038C1B9D0B883E934030F38EEF5F
:100750009FEFF3CF2091040230910502281739074B
:1007600071F09093050280930402E0910202F091EF
:100770000302309721F00084F185E02D099408955B
:1007800020910002309101022817390771F09093EF
:10079000010280930002E0910202F091030230977F
:1007A00021F00680F781E02D09940895E09102027E
:1007B000F0910302309721F00190F081E02D09942F
:1007C00080E0089580E008958238910591F1C0F5A8
:1007D0008133910509F490C028F58932910509F417
:1007E00084C08A32910509F48EC0811520E59207F4
:1007F00008F09EC0811540E4940708F022C18F3BA9
:10080000910508F087C0883A910508F00FC1853A34
:10081000910508F002C18430910500F58130910501
:10082000E9F03CC08533910509F458C0893391053E
:10083000E1F620910B02237089F080EE90E008959C
:10084000833E910571F158F4803E9105E9F0823EB6
:10085000910559F620910B0222FD1EC00895863E97
:10086000910551F1873E910571F1843E910509F0A2
:10087000BCCF20910C0221FFF1CF80910B0284FDAF
:100880000DC087EE90E0089520910B0220FD05C178
:1008900030910C0230FFE2CF24FF02C190E080E0F3
:1008A000DDCF20910B0222FDFEC030910C0230FD05
:1008B000C4CF24FFD3CFF2CF20910B0223FFCECFA2
:1008C00024FDECCFDECF20910B0223FDEFC0309151
:1008D0000C0231FFEECF84EE90E0089520910B02E0
:1008E00025FFBCCF89E290E0089520910B0225FFFF
:1008F000B5CF85E390E0089520910B0226FFAECF9F
:100900008AE290E0089520910B0226FFA7CF81E3B1
:1009100090E00895803E910508F2883E910508F424
:100920009DCF9C013A9521153F4108F497CFB6CF52
:10093000811523E5920740F5811542E5940708F0FB
:1009400088C0811521E5920708F07EC09C0164E013
:10095000369527956A95E1F7922F9370282F269563
:100960002695237040E2249F90011124392B482FB3
:10097000437081E090E002C0880F991F4A95E2F72A
:10098000822B932B9C680895811549E59407F0F418
:10099000811528E5920708F06DC0811544E594079C
:1009A00008F07CCFAC014370552721E030E002C055
:1009B000220F331F4A95E2F78695869540E2849F81
:1009C000C0011124822B932B9A68089581152AE582
:1009D000920708F063CF282F2F7040910B0242FF3F
:1009E00005C083FF4CC0282F2770246030910C0273
:1009F00030FF07C0322F3871383009F046C0277FEA
:100A0000216044FD277E34E0969587953A95E1F77D
:100A10008F70982F822F90690895855AE82FF0E003
:100A2000EA5EFE4F808190E090640895885AE82F36
:100A3000F0E0EE0FFF1FE75EFE4F8081918194642E
:100A400008959F70906A0895982F8827816F906A03
:100A50000895AC014370552721E030E002C0220F19
:100A6000331F4A95E2F78695869540E2849FC00140
:100A7000112486CF982F8827806F906A089582FF6F
:100A8000B5CF282F2B702860B1CF322F3171313084
:100A900009F0B7CF2E7F2860B4CF89E390E00895A6
:100AA00083EE90E0089582EE90E0089586EE90E067
:100AB00008958091920190919101892B90919001DC
:100AC000892B80934B01E0910202F0910302309751
:100AD00099F080911501882369F080910B0287FFBE
:100AE00009C085E080934A010280F381E02D8AE409
:100AF00091E0099481E0F6CF089590911501992332
:100B0000D1F090910B0297FF16C0E82FE695E6957D
:100B1000E695EE31E0F4F0E0E65BFE4F282F27701B
:100B200081E090E001C0880F2A95EAF780959281D4
:100B3000892382830895EDE4F1E09191891303C044
:100B4000DF0111971C9291E0E335F907B1F70895A1
:100B5000909115019923C1F090910B0297FF14C059
:100B6000E82FE695E695E695EE31F8F4F0E0E65BE1
:100B7000FE4F877021E030E001C0220F8A95EAF72E
:100B80008281822B82830895ADE4B1E0EFEF90E0A3
:100B90002D91821751F0EF3F19F4211101C0E92F77
:100BA0009F5F9630A9F7EF3F09F408950E2E000CD1
:100BB000FF0BE65BFE4F838308958F929F92AF9267
:100BC000BF92CF92DF92EF92FF920F931F93CF933A
:100BD000DF938090970190909801A0909901B09038
:100BE0009A01409193015091940160919501709107
:100BF0009601842A952AA62AB72ACFE1D0E0E92EC9
:100C0000F12C2EE0C22E082F10E0DC2ED501C401FD
:100C10000C2E04C0B695A795979587950A94D2F7A0
:100C200080FD11C0219788F7D12C8D2DDF91CF91B8
:100C30001F910F91FF90EF90DF90CF90BF90AF90FA
:100C40009F908F900895CC9EF001CD9EF00D1124C1
:100C5000EE0DFF1DEE0FFF1FEE0FFF1FE00FF11F48
:100C6000EE0FFF1FE455FF4F859194910E94E4031E
:100C70000197C1F2DACF990F990F890F982F9770CA
:100C800086958695869525E0829FF0011124E3598B
:100C9000FE4F50E040E080E0219130E0092E02C09C
:100CA000369527950A94E2F721703327042E01C068
:100CB000220F0A94EAF7822B4F5F5F4F45305105B0
:100CC00059F70895990F990F890F982F977041E060
:100CD00001C0440F9A95EAF786958695869595E02A
:100CE000899FF0011124E359FE4F30E020E070E0CD
:100CF0005191DF011197CB01022E02C09695879585
:100D00000A94E2F7817081958527842385278C9347
:100D10002F5F3F4F2530310559F7089590E080E06F
:100D20000E94C00390E080E00E94AA03109291010B
:100D3000109290010C94590560939701709398015B
:100D40008093990190939A010C948E06609393017D
:100D50007093940180939501909396010C948E0664
:100D6000882341F08095909192018923809392018C
:100D70000C9459050895882339F090919201982B8D
:100D8000909392010C9459050895882309F452C058
:100D9000823871F40E94D60381FF4CC089E30E941F
:100DA000A8050E94590589E30E947D050C94590508
:100DB000833859F40E94D60380FF3CC083E50E942B
:100DC000A8050E94590583E5EFCF843859F40E94A5
:100DD000D60382FF2FC087E40E94A8050E94590510
:100DE00087E4E2CF9CEF980F913AF0F290E2980FEF
:100DF000983088F4877021E030E0A90102C0440FE8
:100E0000551F8A95E2F7CA01809590919201892336
:100E100080939201CBCF9BE5980F933020F490E024
:100E200080E00C94C003885A873120F490E080E081
:100E30000C94AA030895CF93C82F873050F5809162
:100E40000A0190910B01892B11F580E40E9429037E
:100E500090930B0180930A01892BB1F482E10E94E7
:100E6000830390930B0180930A01892B69F481E03D
:100E700090E001C0880FCA95EAF780950E9483032D
:100E800090930B0180930A0184E98093BC00CF9179
:100E900008958A30B1F038F4883069F0893071F003
:100EA000209A2898F4CF8C3091F070F08D30C1F7F3
:100EB0003E9A4698ECCF219A2998E9CF229A2A980F
:100EC000E6CF239A2B98E3CF529A5A98E0CF539AC1
:100ED0005B98DDCF84B1807F84B985B1807F85B98F
:100EE0003E9846988AB1837F8AB98BB1837F8BB94C
:100EF000089580B38D7880BB81B3826781BB0895EC
:100F0000CF92DF92EF92FF920F931F93CF93DF93D5
:100F1000C82F873008F090C080910A0190910B0192
:100F2000892B09F094C080E40E94290390930B015F
:100F300080930A01892B09F44BC090E084E98093E7
:100F4000BC002C2F30E0F901ED52FE4FA081A92703
:100F50009083F901EE0FFF1FEE0FFF1FE556FE4FC6
:100F600070E060E040E0C1E0D0E0CA2ED12C55E056
:100F7000162F8191882309F46CC07F01A1E0EA1A41
:100F8000F1088150D7018C93D60102C0B595A79581
:100F90001A95E2F7A0FF05C08F0101501109D80191
:100FA0005C936F5F7F4F6430710511F72F513E4F97
:100FB000842F8095F901208182239423892BDF914E
:100FC000CF911F910F91FF90EF90DF90CF900895F8
:100FD00083E10E94830390930B0180930A01892B84
:100FE00009F0ABCF81E40E94290390930B01809319
:100FF0000A01892B09F0A1CF84E88093BC000E94EC
:101000001D038C018091BC0087FF08C09091BB003C
:10101000909510920B0110920A0190CF0E941D032F
:10102000801B910B883E934068F38EEF9FEF909367
:101030000B0180930A0181CF8FB19FB1869581709A
:101040009695969596959E70982B90957ACF90E070
:1010500078CF7E01062E01C0EE0C0A94EAF74E29E5
:1010600093CF90913502943031F580930D027093B7
:101070000F0260930E0283E08093E9008FEF90915E
:10108000E800815095FD06C095ED9A95F1F70000B6
:101090008111F5CF8091E80085FF0DC050E040E060
:1010A00063E070E08DE092E00E94D0018091E80062
:1010B0008E778093E8000895BC0184E00C94310899
:1010C000BC0183E00C943108CF93DF93EC01809155
:1010D0001501882321F080910B0260E287FF69E00F
:1010E00083E08093E9008FEF9091E800815095FDB7
:1010F00006C095ED9A95F1F700008111F5CF80912A
:10110000E80085FF19C080911501811118C050E0D9
:1011100040E068E070E0CE0101960E94D00180912D
:10112000E8008E778093E80080E2FE01A3E1B2E060
:1011300001900D928A95E1F7DF91CF91089570E0CB
:1011400050E040E0CE01E9CFCF93C82F882309F4C7
:10115000A6C08238C1F40E94D60381FDA0C089E3F5
:101160000E94A8050E9459052FEF81EE94E02150BE
:1011700080409040E1F700C0000089E30E947D05B7
:10118000CF910C9459058338A1F40E94D60380FDB9
:1011900086C083E50E94A8050E9459052FEF81EEC5
:1011A00094E0215080409040E1F700C0000083E5CA
:1011B000E5CF8438A1F40E94D60382FD70C087E495
:1011C0000E94A8050E9459052FEF81EE94E021505E
:1011D00080409040E1F700C0000087E4CFCF8CEF63
:1011E0008C0F813A88F580911501882301F1809157
:1011F0000B0287FF1CC0EC2FE695E695E695F0E024
:10120000E65BFE4F828190E04C2F477021E030E09A
:1012100002C0220F331F4A95E2F782239323892BC2
:1012200079F08C2F0E947D050E94590509C0EDE4DC
:10123000F1E08191C817A9F321E0E335F207C9F77E
:101240008C2F0E94A8059CCF80E28C0F883068F418
:10125000C77021E030E001C0220FCA95EAF7809103
:101260009201822B809392018BCFEBE5EC0FE33060
:1012700040F4F0E0EA5EFE4F808190E0CF910C9464
:10128000C003C85AC73158F4EC2FF0E0EE0FFF1F2F
:10129000E75EFE4F80819181CF910C94AA03CF919C
:1012A00008950F931F93CF93DF93C62FD42F022F50
:1012B000FC0182818823A1F0609341020E941D03FA
:1012C0009093400280933F02C77081E001C0880F75
:1012D000CA95EAF7DF91CF911F910F910C94BB064D
:1012E00080914102681338C080913F029091400282
:1012F0000E940E03883C910578F510E21D0FCD1772
:10130000B9F080E28C0F883040F4C77081E001C0F2
:10131000880FCA95EAF70E94B006183048F481E0B9
:101320009D2F977001C0880F9A95EAF70E94BB061F
:10133000802F0E94A408802F0E94C506183098F4C0
:10134000D77081E001C0880FDA95EAF7DF91CF917D
:101350001F910F910C94B006C77081E001C0880FF7
:10136000CA95EAF7F3CFDF91CF911F910F910895BE
:1013700080E290E090930B0180930A0180916B01D1
:10138000811111C01092B9008CE08093B80081E007
:1013900080936B012FEF83ED90E3215080409040CC
:1013A000E1F700C0000080E40E94290390930B0144
:1013B00080930A01892B09F040C080E00E948303DA
:1013C00090930B0180930A01892BB9F580E80E9464
:1013D000830390930B0180930A01892B71F58FEFA2
:1013E0000E94830390930B0180930A01892B29F5B6
:1013F00084E98093BC0080E40E94290390930B0150
:1014000080930A01892BC9F48CE00E948303909396
:101410000B0180930A01892B81F480E80E948303E9
:1014200090930B0180930A01892B39F48FEF0E946E
:10143000830390930B0180930A0184E98093BC009D
:1014400080910A010895CF9384E090E00E94F61401
:10145000C82F82E290E00E94F614982F8C2FCF9133
:10146000089569EE7EEF90E080E00E94221560E032
:1014700082E090E00E94041560E083E090E00E942A
:1014800004151092930110929401109295011092FC
:10149000960160E084E090E00E94041560E082E242
:1014A00090E00E94041560E085E090E00E94041541
:1014B00060E086E090E00E9404156FEF87E090E026
:1014C0000E94041540E050E0BA0188E090E00E94DC
:1014D000161560E08DE090E00E94041540E050E0B9
:1014E000BA0188E190E00E94161560E087E190E083
:1014F0000E94041540E050E0BA018CE190E00E94A7
:10150000161570E060E080E290E00E94221540E055
:1015100050E0BA0188E190E00E94161540E050E0EA
:10152000BA018FE090E00E94161540E050E0BA0149
:1015300083E190E00C9416151092920180911501B0
:10154000882369F080910B0287FF09C0ECE4F1E089
:101550008EE1DF011D928A95E9F70C948E06EDE489
:10156000F1E086E0F6CF1F93CF93DF93CDB7DEB7E0
:10157000AA970FB6F894DEBF0FBECDBF87E392E007
:101580002091F100FC012193CF01F2E08F339F07FE
:10159000B9F780913802833009F46FC0B8F4813014
:1015A00009F446C0823009F4B0C08091E80083FF9E
:1015B0007BC280913702909138029A3008F074C251
:1015C000E92FF0E0E65CFA4E0C94F0148A3009F44E
:1015D0008BC08B3009F46EC0893039F780913702A7
:1015E000813219F780913B0290913C02892BE9F6F8
:1015F0008091E800877F8093E8008091E80082FF77
:1016000037C09091F3008091F200029729F4809105
:10161000F1008B7F813021F48091F10080931202E0
:101620008091E8008B778093E8000E94FA01BDCF9B
:1016300080913702813A09F0B8CF8091E800877F26
:101640008093E80080913B0290913C02892B61F4E9
:1016500060E283E192E070E00E94AC028091E800D9
:101660008B778093E800A1CF60E090E080E0F3CF3B
:10167000809135028111C1CF98CF80913702813A94
:1016800009F093CF80913B0290913C02892B09F0A5
:101690008CCF8091E800877F8093E8008091E800FC
:1016A00080FFFCCF809115018093F1008091E800CC
:1016B0008E77B9CF80913702813209F076CF809151
:1016C0003B0290913C02892B09F06FCF8091E8009A
:1016D000877F8093E8000E94FA018091390280930D
:1016E00015010E949C0A61CF80913702813209F076
:1016F0005CCF8091E800877F8093E8000E94FA0128
:1017000080913A028093110250CF80913702813A42
:1017100009F04BCF8091E800877F8093E8008091AB
:10172000E80080FFFCCF80911102BECF803899F095
:10173000823809F0B9C180913B028F70873008F080
:10174000B3C18093E9008091EB0085FB882780F985
:101750001092E90006C080913302909134029111F9
:1017600082609091E800977F9093E8008093F10069
:101770001092F1008091E8008E7792C1882309F4DD
:1017800080C1823009F090C180913902811183C1FA
:1017900080913B028F702FEF280F263008F084C114
:1017A0008093E9002091EB0020FF75C1933031F464
:1017B0008091EB0080628093EB006DC19091EB0013
:1017C00090619093EB0021E030E001C0220F8A95F8
:1017D000EAF72093EA001092EA008091EB0088601B
:1017E000EACF811161C1109139021F778091E30026
:1017F0008078812B8093E3008091E800877F80933D
:10180000E8000E94FA018091E80080FFFCCF8091FF
:10181000E30080688093E30082E0111183E080930D
:10182000350242C18058823008F03EC180913902B1
:1018300090913A028C3D23E09207A1F583E08A83E0
:101840008AE289834FB7F894DE01139620E03EE0E8
:1018500051E2E32FF0E050935700E49120FF03C0E2
:10186000E295EF703F5FEF708E2F90E0EA30C0F0AE
:10187000C7968D939D932F5F243159F74FBF809169
:10188000E800877F8093E8006AE270E0CE0101966D
:101890000E94AC028091E8008B778093E80004C13D
:1018A000C096E7CF40913B0250913C02292F33274D
:1018B0002330310509F444C078F52130310509F4AD
:1018C0006FC08BE390E0E4EEF1E02230310509F0E7
:1018D000EBC02091E800277F2093E80020913D0293
:1018E00030913E028217930708F49C0140E02115D5
:1018F000310509F064C0411162C08091E80082FDA9
:10190000C9CF80913502882329F2853019F2809160
:10191000E80083FFF2CFBECF21323105A9F1223298
:10192000310509F0C1C04115510509F443C04130EA
:10193000510509F0B9C089E190E0ECE1F1E0C9CFCF
:10194000992781309105C1F0009759F0029709F06D
:10195000ABC0E1E3F2E0E4918E2F90E0E1E3F2E04E
:1019600007C0E9E6F2E0E4918E2F90E0E9E6F2E0CC
:10197000009709F499C0ADCFE1E4F2E0E4918E2F35
:1019800090E0E1E4F2E0F4CF4115510571F041300F
:10199000510509F089C089E090E0EFE0F2E099CFCD
:1019A00082E190E0EFE1F2E094CF89E090E0E6EFB1
:1019B000F1E08FCF8FEA90E0E5E3F1E08ACF80910C
:1019C0003502882309F466CF853009F463CF80910E
:1019D000E80083FD5FCF8091E80082FD8ECF80918B
:1019E000E80080FF84CF9091F3008091F2002115F0
:1019F000310519F08830910550F041E0089709F061
:101A000040E08091E8008E778093E80070CF4491A9
:101A10004093F1003196215031090196E8CF80388A
:101A200009F042C08091E800877F8093E8008091B0
:101A300036028093F1009ECE811136C0109139029A
:101A4000123090F58091E800877F8093E800109332
:101A500036020E94FA01112311F084E005C0809142
:101A6000E30087FDFACF81E08093350242E261EC2A
:101A700083E00E94190242E161EC81E00E941902B8
:101A800013C080913902813079F481E0933009F0FC
:101A900080E0809334021092E9008091E800877F13
:101AA0008093E8000E94FA018091E80083FF0AC059
:101AB0008091E800877F8093E8008091EB0080624E
:101AC0008093EB00AA960FB6F894DEBF0FBECDBF91
:101AD000DF91CF911F9108958F929F92AF92BF9205
:101AE000CF92DF92EF92FF920F931F93CF93DF93EA
:101AF000CDB7DEB72F970FB6F894DEBF0FBECDBFC0
:101B00004B875C876D877E878F876111109291016B
:101B100085E0FE013B96DE01169601900D928A95B6
:101B2000E1F789859A85892B39F01E810F81812FF4
:101B300080238F3F09F078C32F960FB6F894DEBF4D
:101B40000FBECDBFDF91CF911F910F91FF90EF900E
:101B5000DF90CF90BF90AF909F908F9008950E949C
:101B6000DD05F82E682F89819A810E946206E02F98
:101B7000F0E02EE0F29EE00DF11D1124EE0FFF1FAC
:101B8000EE0FFF1FE10FF11DEE0FFF1FE455FF4F9A
:101B900005911491C80180549A458034910508F448
:101BA00075C0043F3CE5130709F494C0B0F4093D47
:101BB0009CE5190709F48AC00A3D2CE5120709F4CF
:101BC00099C0083D3CE51307A1F426E241EE61EE21
:101BD000CE0106960E945109AFCF063F8CE518074B
:101BE00009F480C008F47AC0073F2CE5120709F415
:101BF0007DC08885882309F428C3109241020230F1
:101C00003CE5130708F455C106319CE5190738F087
:101C100098012B5F3C452930310508F04AC10E94EC
:101C2000230A90930C0280930B0200312CE51207DB
:101C300009F40EC108F098C008308CE5180709F4C3
:101C4000F5C008F06DC004302CE5120709F4E6C0B9
:101C500008F053C002308CE5180709F4D9C0809110
:101C60000B02826003301C4509F4D5C060910B0261
:101C700010910C0284E090E00E940415612F82E232
:101C800090E00E9404150E949C0A56CF0054E02F59
:101C9000E695E695E695F0E0E35FFE4F208110E0E3
:101CA000009510950770112781E090E001C0880F22
:101CB0000A95EAF73885332331F0822B808381E05F
:101CC0008093FF0139CF80958223F8CF27E245EE3C
:101CD00065EE7ECF26E241EE60EE7ACF27E245EE5A
:101CE00064EE76CF26E241EE62EE72CF27E245EE59
:101CF00066EE6ECF28E241E0EBCF80910B0280616F
:101D000006302CE5120709F486C080910B0288602A
:101D100007301C4508F47FC080910B0280627BC0B5
:101D20000C308CE5180709F48BC070F480910B021D
:101D30008C600A302CE5120709F46DC008F47AC0F3
:101D400080910B028E7F67C00E308CE5180709F476
:101D50007BC080910B028B7F0F301C4508F45BC069
:101D600080910B028F7E57C00C3F2CE5120709F4BF
:101D700059C030F503318CE5180709F471C078F4C7
:101D800001312CE5120709F467C002311C4509F046
:101D90006DCF0E949C0A80910B028F773CC0053169
:101DA0008CE5180709F464C008F478C080910C022F
:101DB00081600B3F1C4509F059CF80930C0256CF30
:101DC00001153DE5130709F44FC088F480910C021A
:101DD0008D7F0E3F9CE5190781F380910C028E7F69
:101DE0000F3F1C4550F380910C028360E6CF023018
:101DF0003DE5130709F45BC008F446C060E003301A
:101E00001D4509F033CF8EE090E00E9404152ECFDF
:101E100080910B02816080930B0228CF80910B028E
:101E20008460F9CF80910C028260C7CF80910B0251
:101E30008064F1CF0E949C0A80910B028068EBCFF6
:101E400080910B028D7FE7CF80910B02877FE3CFDC
:101E500080910B028F7DDFCF80910B028F7BDBCFD8
:101E600080910B02837FD7CF80910C028C7FA5CF0E
:101E700080910B0282FB992790F921E0922790FB39
:101E800082F990FB83F9C7CF80910C02982F90952F
:101E900091708E7F892B90FB81F98FCF0E949C0AD5
:101EA00090910B02892F97FB87F98058B4CF61E09E
:101EB000AACF06312CE5120709F0D2C18091920118
:101EC0008A7A91E009F490E090936C01811106C048
:101ED00089E20E94A8050E9459052ECE85E3F9CF1C
:101EE00085E3BBC10E949C0A3FEF84E39CE0315034
:101EF00080409040E1F700C0000081E08093E00066
:101F000080E28093D8001092C9008FE19EE401978F
:101F1000F1F700C0000087E090EBDC018093420203
:101F200090934302A0934402B093450288E19CE061
:101F30000FB6F894A895809360000FBE9093600050
:101F4000FFCF0E94310AF8CD812F902F0E943B06CF
:101F5000F82E9EC1183009F47DC0193009F0BBC1BC
:101F60009F70C12CD12C7601C39404C0CC0CDD1C15
:101F7000EE1CFF1C9A95D2F7882309F43FC16091AB
:101F80009701709198018091990190919A016C2923
:101F90007D298E299F290E949C06802F0E94BB06C6
:101FA0009AC1292F2F70F22E907F19F0F294A0EF92
:101FB000FA228823C9F0FF2069F080E2800F883080
:101FC00010F001110BC080919201F82AF092920159
:101FD0000E945905802F0E94A4087DC18091910123
:101FE000F82AF0929101F4CF802F0E94C506FF20BD
:101FF00009F471C1F094005E083010F0E11008C0DF
:1020000080919201F822F09292010E94590563C1D9
:1020100080919101F822F0929101F7CF292F269516
:102020002695237051F0213009F055C1882379F0AD
:10203000802F93700E94AA034EC1882329F0802F1D
:1020400093700E94C00347C190E080E0FACF90E017
:1020500080E0F0CF292F237009F065C081113BC1CA
:10206000802F829586958770880F880F402F4F703C
:1020700050E070E060E0082E04C0440F551F661F5A
:10208000771F0A94D2F7C12CD12C760104FF10C01F
:10209000FFE0CF2ED12CE12CF12C04C0CC0CDD1CA8
:1020A000EE1CFF1C8A95D2F7C094D094E094F09473
:1020B000969596959370923019F1D8F4809093018B
:1020C00090909401A0909501B0909601913069F0A4
:1020D0004C295D296E297F29CB01BA01682179211C
:1020E0008A219B210E94A606F6C0482959296A29FF
:1020F0007B29CB01BA016C297D298E299F29F2CF3A
:102100004C295D296E297F29C0909301D0909401BC
:10211000E0909501F0909601CB01BA016C257D25E8
:102120008E259F25DFCF2695882311F0292F21703A
:10213000222309F4D0C0802F829586958770880F5E
:10214000880F402F4F7050E070E060E0082E04C010
:10215000440F551F661F771F0A94D2F7C12CD12C4C
:10216000760104FF10C0EFE0CE2ED12CE12CF12C33
:1021700004C0CC0CDD1CEE1CFF1C8A95D2F7C09469
:10218000D094E094F094969596959370923019F1CE
:10219000D8F48090970190909801A0909901B09008
:1021A0009A01913069F04C295D296E297F29CB0174
:1021B000BA01682179218A219B210E949C068BC04B
:1021C000482959296A297B29CB01BA016C297D2923
:1021D0008E299F29F2CF4C295D296E297F29C09035
:1021E0009701D0909801E0909901F0909A01CB016D
:1021F000BA016C257D258E259F25DFCF802F0E947B
:10220000B006C701B6016095709580959095C09015
:102210009701D0909801E0909901F0909A016C217B
:102220007D218E219F21C9CF85E0FE013696DE01FA
:10223000119601900D928A95E1F789819A81611139
:102240008ECC0E943B06F82E92CC06311C4589F4B8
:1022500080916C01811144CE89E20E947D053BCEC4
:1022600001152CE5120709F43DCE0F3D1C4509F47C
:1022700068CE1E810F81882309F466CE812F902FAE
:102280000E94DD05F82E682F812F902F0E94620694
:10229000E02FF0E09EE0F99EE00DF11D1124EE0F1D
:1022A000FF1FEE0FFF1FE10FF11DEE0FFF1FE455A3
:1022B000FF4F859194910E94E403082FE82E8885B2
:1022C000192F12951F70143009F4A8CE08F042CED1
:1022D000123008F466CE212F2850330B22303105FE
:1022E00010F40E94D60385E0FE013696DE011196B9
:1022F00001900D928A95E1F789819A810E943B06AF
:10230000EA81F0E03EE0839FE00DF11D1124CF0152
:10231000880F991F880F991FE981E80FF92FF11D88
:10232000EE0FFF1FE455FF4F8591949105CC0F935D
:102330001F93CF93DF9380910A0190910B01892B1A
:1023400071F080916A018F5F80936A01811107C0EB
:102350000E94B80990E090930B0180930A0101EE6E
:1023600011E0C0E08C2F0E941B07D7E0DC0F8D2FFF
:102370000E941B078C2F0E948007F80181938F0118
:102380008D2F0E948007F80186830E946A07CF5F25
:10239000C73041F781E0DF91CF911F910F910895F0
:1023A0001F920F920FB60F9211242F933F934F93CA
:1023B0005F936F937F938F939F93AF93BF93CF93CD
:1023C000DF93EF93FF93D091E900DF708091EC00F1
:1023D000C82FC17080FDC0E81092E9008091F00024
:1023E000877F8093F00078940E94B30A1092E900EE
:1023F0008091F00088608093F000CD2BCF70C09367
:10240000E900FF91EF91DF91CF91BF91AF919F9143
:102410008F917F916F915F914F913F912F910F908D
:102420000FBE0F901F9018951F920F920FB60F922C
:1024300011242F933F934F935F936F937F938F93C9
:102440009F93AF93BF93EF93FF938091E10082FF3F
:1024500009C08091E20082FF05C08091E1008B7F7E
:102460008093E1008091DA0080FF24C08091D80041
:1024700080FF20C08091DA008E7F8093DA00809107
:10248000D90080FF9BC080E189BD82E189BD09B48C
:1024900000FEFDCF81E08093350280911002811112
:1024A00009C00E9480010E944B028091E20084607A
:1024B0008093E2008091E10080FF17C08091E200EC
:1024C00080FF13C08091E2008E7F8093E2008091B4
:1024D000E20080618093E2008091D8008062809366
:1024E000D80019BC85E0809335028091E10084FF1B
:1024F00029C08091E20084FF25C080E189BD82E18E
:1025000089BD89B5982F917080FFFBCF8091D8004D
:102510008F7D8093D8008091E1008F7E8093E100D1
:102520008091E2008F7E8093E2008091E2008160E2
:102530008093E20080913602882309F445C084E04C
:10254000809335028091E10083FF27C08091E200F3
:1025500083FF23C08091E100877F8093E10082E0C8
:1025600080933502109236028091E1008E7F809335
:10257000E1008091E2008E7F8093E2008091E20092
:1025800080618093E20042E060E080E00E941902F6
:102590008091F00088608093F000FF91EF91BF91EF
:1025A000AF919F918F917F916F915F914F913F91EB
:1025B0002F910F900FBE0F901F90189519BC10927D
:1025C00035021092100276CF8091E30087FD93E0F0
:1025D00090933502B7CF78941F921FB61F921124A3
:1025E0008F939F93AF93BF938091070290910802BE
:1025F000A0910902B0910A020196A11DB11D80931C
:10260000070290930802A0930902B0930A02BF91B7
:10261000AF919F918F911F901FBE1F9018951F9291
:102620001FB61F9211248F939F93AF93BF938091F6
:102630000602811113C08091070290910802A091B7
:102640000902B0910A024196A11DB11D80930702B3
:1026500090930802A0930902B0930A02BF91AF9130
:102660009F918F911F901FBE1F901895CDB7DEB719
:102670002A970FB6F894DEBF0FBECDBF84B7877F11
:1026800084BF0FB6F894A89580916000886180930C
:102690006000109260000FBE80E890E00FB6F894E2
:1026A00080936100909361000FBE85B7806885BFFD
:1026B00085B7806885BF82EE93E09093490180934F
:1026C00048010E9480010E944B028091E2008460D8
:1026D0008093E2007894809135028823A1F01091D4
:1026E000E9001F709091EC00892F817090FD80E8C7
:1026F000182B1092E9008091E80083FD0E94B30A34
:102700001F701093E90082E084BD93E095BD9AEFBD
:1027100097BD80936E000E94B80990E090930B01E2
:1027200080930A010E946A070E94790783ED91E075
:10273000EBE9F1E041EE51E0DA011D92AD01DC017F
:102740001D92CD0110821182128213823496B1E063
:102750004F3E5B0789F790E080E00E94FE14893EBF
:102760009E4F11F00E94310A82E090E00E94F61420
:102770008093F0010E94230A90930C0280930B0235
:1027800083E090E00E94F614682F70E090E080E013
:102790000E94A6063F988AB18F708AB96E98479AB0
:1027A0008BB1806F8BB9769A60910B0260686093F1
:1027B0000B0210910C0284E090E00E940415612F3E
:1027C00082E290E00E94041580E091E09093030281
:1027D0008093020288E1C82ED12C90E4992E20E14A
:1027E000A22E32E1B32EEE24EA9480913502853098
:1027F00049F480913502853009F479C00E949C0A21
:102800000E94D6030E949711882359F08FB7F8943D
:1028100040910702509108026091090270910A02EA
:102820008FBFE1EFF1E0A1EEB1E010E000E0302F6A
:102830008D919191981709F4A7C0292F282790E02E
:10284000FF24F3944F2D422309F499C099833A83CE
:102850008F2191E009F490E09B830E941D03816029
:10286000782F9D838C8349815A816B818D810E9451
:102870006C0DF801EF50FE4F8081F826F0820E9427
:10288000D6039091EF01891721F00E94D60380931F
:10289000EF0180913502843009F0A7CF8091FF01CC
:1028A000882309F4A2CF1091E9001F709091EC00E9
:1028B000892F817090FD80E8182B81E08093E900DA
:1028C0008091E80080FF0FC050E040E069E070E0D8
:1028D0008CE091E00E94D0018091E8008E77809397
:1028E000E8001092FF011F701093E9007ECF8091E5
:1028F0003502843009F1109206020FB6F894A895BB
:10290000C09260000FBE9092600083B7817F8460A8
:1029100083BF83B7816083BF7894889583B78E7FA8
:1029200083BF0FB6F894A89580916000886180936A
:102930006000109260000FBE80913402882309F479
:1029400058CF0E94B80990E090930B0180930A0140
:102950000E946A070E947907E1EEF1E0119281E09E
:10296000EF3EF807D9F70E949711E1EEF1E081916F
:10297000811120C0A1E0EF3EFA07C9F73ACF9F5F6F
:10298000FF0C943009F05ECF0F5F1F4F0E30110522
:1029900009F04DCFEE82EF8218860E941D03816000
:1029A000782F9A8789874E815F8168858A850E9402
:1029B0006C0D65CFA9BCB9BC09B400FEFDCF8091F8
:1029C000D8008F7D8093D8008091E0008260809352
:1029D000E0008091E00081FDFCCF0E949C0A09CFBD
:1029E000EE0FFF1F0590F491E02D0994F999FECFA9
:1029F00092BD81BDF89A992780B50895A8E1B0E00D
:102A000042E050E00C942A15262FF999FECF92BD92
:102A100081BDF89A019700B4021639F01FBA20BDA3
:102A20000FB6F894FA9AF99A0FBE08950396272FD5
:102A30000E9405150E940415252F0E940515242FBC
:102A40000C9405150196272F0E9405150C9404156A
:102A5000DC01CB01FC01F999FECF06C0F2BDE1BD5E
:102A6000F89A319600B40D9241505040B8F708954D
:102A7000F894FFCF960BBE0B540DBE0B540DF10B0B
:082A8000120C540D0F0D1C0D8A
:102A88000B0364080A0360085C082000500000007B
:102A9800000000000001818283E200E900EA00B53D
:102AA80000B600B700CD008301CC008A01920194E2
:102AB800012102230224022502260227022A02B348
:082AC80000B4006F0070000073
:00000001FF

View file

@ -1,5 +1,5 @@
'''
A plover machine plugin for supporting the Plover HID protocol.
A plover machine plugin for supporting the RKB1 HID protcol
This protocol is a simple HID-based protocol that sends the current state
of the steno machine every time that state changes.
@ -16,6 +16,8 @@ from plover import log
from bitstring import BitString
import hid
import platform
import threading
import time
# This is a hack to not open the hid device in exclusive mode on
# darwin, if the version of hidapi installed is current enough
@ -28,30 +30,20 @@ if platform.system() == "Darwin":
except AttributeError as e:
log.error("hidapi < 0.12 in use, plover-hid will not work correctly")
USAGE_PAGE: int = 0xFF50
USAGE: int = 0x4C56
USAGE_PAGE: int = 0xFF60
USAGE: int = 0x61
N_LEVERS: int = 64
N_LEVERS: int = 80
# A simple report contains the report id 1 and one bit
# for each of the 64 buttons in the report.
SIMPLE_REPORT_TYPE: int = 0x01
SIMPLE_REPORT_LEN: int = N_LEVERS // 8
SIMPLE_REPORT_TYPE: int = 0x62
SIMPLE_REPORT_LEN: int = 32
class InvalidReport(Exception):
pass
STENO_KEY_CHART = ("S-", "T-", "K-", "P-", "W-", "H-",
"R-", "A-", "O-", "*", "-E", "-U",
"-F", "-R", "-P", "-B", "-L", "-G",
"-T", "-S", "-D", "-Z", "#",
"X1", "X2", "X3", "X4", "X5", "X6",
"X7", "X8", "X9", "X10", "X11", "X12",
"X13", "X14", "X15", "X16", "X17", "X18",
"X19", "X20", "X21", "X22", "X23", "X24",
"X25", "X26", "X27", "X28", "X29", "X30",
"X31", "X32", "X33", "X34", "X35", "X36",
"X37", "X38", "X39", "X40", "X41")
STENO_KEY_CHART = set(f"X{i}" for i in range(1, N_LEVERS + 1))
print('steno key chart', len(STENO_KEY_CHART))
class HidMachine(ThreadedStenotypeBase):
@ -72,18 +64,22 @@ class HidMachine(ThreadedStenotypeBase):
self._hid = None
def _parse(self, report):
# The first byte is the report id, and due to idiosynchrasies
# in how HID-apis work on different operating system we can't
# map the report id to the contents in a good way, so we force
# compliant devices to always use a report id of 0x50 ('P').
if len(report) > SIMPLE_REPORT_LEN and report[0] == 0x50:
return BitString(report[1:SIMPLE_REPORT_LEN+1])
else:
if len(report) != SIMPLE_REPORT_LEN:
raise InvalidReport()
if report[:3] != b"STN":
raise InvalidReport()
return BitString(bytes=report[3:13])
def _ping_thread(self):
while not self.finished.wait(0):
self._hid.write(b"STN" + (b"\0" * 29))
time.sleep(10)
def run(self):
self._ready()
keystate = BitString(N_LEVERS)
thread = threading.Thread(target=self._ping_thread)
thread.start()
while not self.finished.wait(0):
try:
report = self._hid.read(65536, timeout=1000)