Repository navigation
feat(wlmouse): full Beast X V2 dongle/macro/curve parity & fix #76, #77, #79 #80
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -259,14 +259,6 @@ export function extras(s: any): Section[] { | |
| current: wl.lodMode, | ||
| }); | ||
| } | ||
| if (typeof s.supportsSeparateDpiAxes === "boolean") { | ||
| sensorControls.push({ | ||
| id: "wl.separateAxes", | ||
| label: "Independent X/Y DPI", | ||
| kind: "toggle", | ||
| current: s.supportsSeparateDpiAxes, | ||
| }); | ||
| } | ||
| if (wl.sensorPosition) { | ||
| sensorControls.push({ | ||
| id: "wl.sensorX", | ||
|
|
@@ -286,6 +278,13 @@ export function extras(s: any): Section[] { | |
| step: 1, | ||
| current: wl.sensorPosition.y, | ||
| }); | ||
| sensorControls.push({ | ||
| id: "wl.sensorReset", | ||
| label: "Sensor position", | ||
| kind: "button", | ||
| options: [{ value: true, label: "Restore (0, 0)" }], | ||
| current: null, | ||
| }); | ||
| } | ||
| if (wl.bhopWheel) { | ||
| sensorControls.push({ | ||
|
|
@@ -306,28 +305,41 @@ export function extras(s: any): Section[] { | |
| ], | ||
| current: wl.bhopWheel.direction, | ||
| }); | ||
| sensorControls.push({ | ||
| id: "wl.bhopWindow", | ||
| label: "BHop filter window", | ||
| kind: "number", | ||
| min: 0, | ||
| max: 750, | ||
| step: 10, | ||
| unit: "ms", | ||
| current: wl.bhopWheel.windowMs, | ||
| }); | ||
| } | ||
| } | ||
| if (wl.dynamicDpi) { | ||
| sensorControls.push({ | ||
| id: "wl.dynDpi", | ||
| label: "Dynamic DPI", | ||
| kind: "toggle", | ||
| current: Boolean(wl.dynamicDpi.enabled), | ||
| id: "wl.bhopWindow", | ||
| label: "BHop filter window", | ||
| kind: "number", | ||
| min: 0, | ||
| max: 750, | ||
| step: 10, | ||
| unit: "ms", | ||
| current: wl.bhopWheel.windowMs, | ||
| }); | ||
| } | ||
| if (sensorControls.length) out.push({ title: "WLMouse · Sensor & scroll", controls: sensorControls }); | ||
|
|
||
| if (wl.dynamicDpi) { | ||
| const pts: Array<{ speed: number; ratio: number }> = Array.isArray(wl.dynamicDpi.points) && wl.dynamicDpi.points.length | ||
| ? wl.dynamicDpi.points | ||
| : [{ speed: 0, ratio: 1 }, { speed: 20, ratio: 2.62 }, { speed: 40, ratio: 4.8 }]; | ||
| const curveControls: Control[] = [ | ||
| { | ||
| id: "wl.curve/enabled", | ||
| label: "Dynamic DPI", | ||
| kind: "toggle", | ||
| current: Boolean(wl.dynamicDpi.enabled), | ||
| }, | ||
| ]; | ||
| pts.forEach((pt, idx) => { | ||
| curveControls.push( | ||
| { id: `wl.curve.${idx}.speed`, label: `Point ${idx + 1} speed`, kind: "number", min: 0, max: 250, step: 1, current: pt.speed }, | ||
| { id: `wl.curve.${idx}.gain`, label: `Point ${idx + 1} ratio`, kind: "number", min: 0.1, max: 8, step: 0.01, current: pt.ratio }, | ||
| ); | ||
| }); | ||
| out.push({ title: "WLMouse · Dynamic DPI", controls: curveControls }); | ||
|
macroscopeapp[bot] marked this conversation as resolved.
Resolved
|
||
| } | ||
|
|
||
| if (wl.dongleScreen) { | ||
| const lcd = wl.dongleScreen; | ||
| out.push({ | ||
|
|
@@ -357,6 +369,22 @@ export function extras(s: any): Section[] { | |
| kind: "toggle", | ||
| current: Boolean(lcd.doubleTapEnabled), | ||
| }, | ||
| { | ||
| id: "wl.lcdUpload", | ||
| label: "Custom visuals", | ||
| description: "Pick 1 Main + up to 5 Random images or GIFs (320×170, max 13 MB).", | ||
| kind: "openImage", | ||
| options: [{ value: true, label: "Upload images / GIFs" }], | ||
| current: null, | ||
| }, | ||
| { | ||
| id: "wl.lcdDelete", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High A Games profile containing 🚀 Reply "fix it for me" or copy this AI Prompt for your agent: |
||
| label: "Reset visuals", | ||
| description: "Deletes uploaded images and restores the default dongle visuals.", | ||
| kind: "button", | ||
| options: [{ value: true, label: "Delete custom images" }], | ||
| current: null, | ||
| }, | ||
| ], | ||
| }); | ||
| } | ||
|
|
@@ -908,6 +936,10 @@ export async function writeControl(info: HidInterfaceInfo, status: any, id: stri | |
| await callClientMethod(info, "setSeparateDpiAxes", Boolean(value)); | ||
| status.supportsSeparateDpiAxes = Boolean(value); | ||
| return; | ||
| case "wl.sensorReset": | ||
|
macroscopeapp[bot] marked this conversation as resolved.
Resolved
|
||
| await callClientMethod(info, "setSensorPosition", 0, 0); | ||
| if (status.wlmouse) status.wlmouse.sensorPosition = { x: 0, y: 0 }; | ||
| return; | ||
| case "wl.sensorX": case "wl.sensorY": { | ||
| const cur = status.wlmouse?.sensorPosition ?? { x: 0, y: 0 }; | ||
| const x = id === "wl.sensorX" ? Math.round(Number(value)) : cur.x; | ||
|
|
@@ -927,13 +959,23 @@ export async function writeControl(info: HidInterfaceInfo, status: any, id: stri | |
| if (status.wlmouse) status.wlmouse.bhopWheel = next; | ||
| return; | ||
| } | ||
| case "wl.dynDpi": { | ||
| case "wl.dynDpi": case "wl.curve/enabled": { | ||
| const cur = status.wlmouse?.dynamicDpi ?? { enabled: false, points: [{ speed: 0, ratio: 1 }, { speed: 20, ratio: 2.62 }, { speed: 40, ratio: 4.8 }] }; | ||
| const next = { ...cur, enabled: Boolean(value) }; | ||
| await callClientMethod(info, "setDynamicDpi", next); | ||
| if (status.wlmouse) status.wlmouse.dynamicDpi = next; | ||
| return; | ||
| } | ||
| case "wl.curve": { | ||
| const cur = status.wlmouse?.dynamicDpi ?? { enabled: true, points: [{ speed: 0, ratio: 1 }, { speed: 20, ratio: 2.62 }, { speed: 40, ratio: 4.8 }] }; | ||
| const points = Array.isArray(value) | ||
| ? value.map((pair: any) => ({ speed: Math.round(Number(pair[0])), ratio: Number(pair[1]) })) | ||
| : cur.points; | ||
| const next = { ...cur, points }; | ||
| await callClientMethod(info, "setDynamicDpi", next); | ||
| if (status.wlmouse) status.wlmouse.dynamicDpi = next; | ||
| return; | ||
| } | ||
| case "wl.lcdEnabled": | ||
| await callClientMethod(info, "setDongleScreenEnabled", Boolean(value)); | ||
| if (status.wlmouse?.dongleScreen) status.wlmouse.dongleScreen.enabled = Boolean(value); | ||
|
|
@@ -946,6 +988,21 @@ export async function writeControl(info: HidInterfaceInfo, status: any, id: stri | |
| await callClientMethod(info, "setDongleDoubleTap", Boolean(value)); | ||
| if (status.wlmouse?.dongleScreen) status.wlmouse.dongleScreen.doubleTapEnabled = Boolean(value); | ||
| return; | ||
| case "wl.lcdUpload": { | ||
| const items = Array.isArray(value) ? value : []; | ||
| if (!items.length) return; | ||
| const images = items.map((item: any) => ({ | ||
| width: Number(item.width) || 320, | ||
| height: Number(item.height) || 170, | ||
| format: item.format === "gif" ? "gif" : "rgb565", | ||
| data: decodeBase64(String(item.base64 ?? "")), | ||
| })); | ||
| await callClientMethod(info, "uploadDongleImages", images); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High Valid 🚀 Reply "fix it for me" or copy this AI Prompt for your agent:There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Multi-image dongle uploads hit the 15-second action timeout.
The deadline must cover the duration of the largest supported upload. Alternatively, each upload call must complete within the deadline. Choose one approach. A longer deadline for this method is one option. Uploading each image in a separate call is another, but that call sequence also changes the
|
||
| return; | ||
| } | ||
| case "wl.lcdDelete": | ||
| await callClientMethod(info, "deleteDongleImages"); | ||
| return; | ||
| case "gen.profile": return w.setProfile(info, Number(value)); | ||
| case "gen.powerMode": return callClientMethod(info, "setPowerMode", value); | ||
| case "perf.sleep": return w.setSleepTimeout(info, Number(value)); | ||
|
|
@@ -1005,3 +1062,38 @@ export async function writeLighting(info: HidInterfaceInfo, status: any, edit: { | |
| writeOnly: l.writeOnly, | ||
| } as any); | ||
| } | ||
|
|
||
| const B64_LOOKUP = (() => { | ||
| const table = new Uint8Array(128).fill(255); | ||
| const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | ||
| for (let i = 0; i < chars.length; i += 1) table[chars.charCodeAt(i)] = i; | ||
| return table; | ||
| })(); | ||
|
|
||
| function decodeBase64(input: string): Uint8Array { | ||
| const clean = input.replace(/[^A-Za-z0-9+/]/g, ""); | ||
| const out = new Uint8Array(Math.floor((clean.length * 3) / 4)); | ||
| let pos = 0; | ||
| for (let i = 0; i + 3 < clean.length; i += 4) { | ||
| const a = B64_LOOKUP[clean.charCodeAt(i)]!; | ||
| const b = B64_LOOKUP[clean.charCodeAt(i + 1)]!; | ||
| const c = B64_LOOKUP[clean.charCodeAt(i + 2)]!; | ||
| const d = B64_LOOKUP[clean.charCodeAt(i + 3)]!; | ||
| out[pos++] = (a << 2) | (b >> 4); | ||
| out[pos++] = ((b & 15) << 4) | (c >> 2); | ||
| out[pos++] = ((c & 3) << 6) | d; | ||
| } | ||
| const rem = clean.length & 3; | ||
| if (rem === 2) { | ||
| const a = B64_LOOKUP[clean.charCodeAt(clean.length - 2)]!; | ||
| const b = B64_LOOKUP[clean.charCodeAt(clean.length - 1)]!; | ||
| out[pos++] = (a << 2) | (b >> 4); | ||
| } else if (rem === 3) { | ||
| const a = B64_LOOKUP[clean.charCodeAt(clean.length - 3)]!; | ||
| const b = B64_LOOKUP[clean.charCodeAt(clean.length - 2)]!; | ||
| const c = B64_LOOKUP[clean.charCodeAt(clean.length - 1)]!; | ||
| out[pos++] = (a << 2) | (b >> 4); | ||
| out[pos++] = ((b & 15) << 4) | (c >> 2); | ||
| } | ||
| return out.subarray(0, pos); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declaring-only Razer writes can reach non-declaring siblings.
For
1532:007dand1532:0099,send_eachcan write a feature report to an interface whose descriptor does not declare it. This happens when no split declares the report, which occurs when descriptors are unreadable on the platform.declaring_only_splitsthen returns every split, andsend_eachwrites to them in order until one succeeds. Thefeature_reports_declaring_onlycontract says these reports must never reach a sibling. The fallback violates that contract. The issues attribute sibling writes to dropped connections and overwritten pending commands on these devices.The required behavior is that a declaring-only feature write must not reach a non-declaring interface. If no interface is known to declare the report, the write must fail rather than fall through. Choose how read-back and the affected platforms handle that failure. Failing closed can leave these devices unusable on a platform where descriptors cannot be read, so that trade-off needs an explicit decision before a code change.