|
29 | 29 |
|
30 | 30 | logger = logging.getLogger(__name__) |
31 | 31 |
|
32 | | -CLAW_SET_DINPUT = bytes([0x0F, 0x00, 0x00, 0x3C, 0x24, 0x02]) |
| 32 | +CLAW_SET_M1 = bytes( |
| 33 | + [0x0F, 0x00, 0x00, 0x3C, 0x21, 0x01, 0x00, 0x7A, 0x05, 0x01, 0x00, 0x00, 0x11, 0x00] |
| 34 | +) |
| 35 | +CLAW_SET_M2 = bytes( |
| 36 | + [0x0F, 0x00, 0x00, 0x3C, 0x21, 0x01, 0x01, 0x1F, 0x05, 0x01, 0x00, 0x00, 0x12, 0x00] |
| 37 | +) |
| 38 | +CLAW_SYNC_ROM = bytes([0x0F, 0x00, 0x00, 0x3C, 0x22]) |
| 39 | +CLAW_SET_DINPUT = bytes([0x0F, 0x00, 0x00, 0x3C, 0x24, 0x02, 0x00]) |
| 40 | +CLAW_SET_MSI = bytes([0x0F, 0x00, 0x00, 0x3C, 0x24, 0x03, 0x00]) |
33 | 41 |
|
34 | 42 | MSI_CLAW_VID = 0x0DB0 |
35 | 43 | MSI_CLAW_XINPUT_PID = 0x1901 |
@@ -110,10 +118,17 @@ def consume(self, events: Sequence[Event]) -> None: |
110 | 118 | ) |
111 | 119 | self.dev.write(cmd) |
112 | 120 |
|
113 | | - def set_dinput_mode(self): |
| 121 | + def set_dinput_mode(self, init: bool = False) -> None: |
114 | 122 | if not self.dev: |
115 | 123 | return |
116 | 124 |
|
| 125 | + # Make sure M1/M2 are recognizable |
| 126 | + if init: |
| 127 | + self.dev.write(CLAW_SET_M1) |
| 128 | + self.dev.write(CLAW_SET_M2) |
| 129 | + self.dev.write(CLAW_SYNC_ROM) |
| 130 | + self.dev.write(CLAW_SET_MSI) |
| 131 | + |
117 | 132 | # Set the device to dinput mode |
118 | 133 | self.dev.write(CLAW_SET_DINPUT) |
119 | 134 |
|
@@ -203,7 +218,7 @@ def plugin_run( |
203 | 218 | ) |
204 | 219 | try: |
205 | 220 | d_vend.open() |
206 | | - d_vend.set_dinput_mode() |
| 221 | + d_vend.set_dinput_mode(init=True) |
207 | 222 | d_vend.close(True) |
208 | 223 | time.sleep(2) |
209 | 224 | except Exception as e: |
|
0 commit comments