Skip to content

Commit

Permalink
fix: not getting key/wheel events when wireless
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Nov 19, 2021
1 parent ce1c721 commit 64fbb01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions packages/core/src/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export class XencelabsQuickKeysDevice extends EventEmitter<XencelabsQuickKeysEve
public static async create(device: HIDDevice): Promise<XencelabsQuickKeysDevice> {
const wrappedDevice = new XencelabsQuickKeysDevice(device)

// Ask the device to stream presses
await wrappedDevice.subscribeToKeyEvents()

// Now setup the hid events
wrappedDevice.subscribeToHIDEvents()

// Ask the device to stream presses
await wrappedDevice.subscribeToKeyEvents()

return wrappedDevice
}

Expand Down Expand Up @@ -77,6 +77,8 @@ export class XencelabsQuickKeysDevice extends EventEmitter<XencelabsQuickKeysEve
buffer.writeUInt8(0xb0, 1)
buffer.writeUInt8(0x04, 2)

this.insertHeader(buffer)

return this.device.sendReports([buffer])
}

Expand Down
2 changes: 1 addition & 1 deletion packages/webhid/src/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class WebHIDDevice extends EventEmitter implements CoreHIDDevice {
return Buffer.from(view.buffer)
}
public async sendReports(buffers: Buffer[]): Promise<void> {
return this.reportQueue.add(async () => {
await this.reportQueue.add(async () => {
for (const data of buffers) {
await this.device.sendReport(data[0], new Uint8Array(data.slice(1)))
}
Expand Down

0 comments on commit 64fbb01

Please sign in to comment.