Close

Back to JS with webHID

A project log for USBShare.exe

Replacing unknown exe with opensource

stephengeorgeweststephengeorgewest 09/18/2021 at 06:440 Comments
document.addEventListener('DOMContentLoaded', async () => {
    let permissionsRequestButton = document.getElementById("switch");
    permissionsRequestButton.addEventListener("click", () => {
        navigator.hid.requestDevice({ 
            filters: [{ vendorId: 0x1a86, productId: 0xe041 }] 
        }).then((devices) =>{
            devices[0].open().then(() => {
                const wValue = new Uint8Array([
                    0x55, 0x02, 0x00, 0x00,
                    0x00, 0x00, 0x00, 0x00
                ]);
                devices[0].sendReport(0, wValue).then(() => {
                    console.log("Sent output report: "+ wValue);
                }).catch(err => {
                    console.log(err + " " + wValue)
                })
            })
        });
    });
});

I guess I only really need the one USBHID SET_REPORT

Discussions