Tekk-Know / RazerBatteryTaskbar

53 stars 20 forks source link

Changing product id to Razer Deathadder V2 Pro fails #1

Closed axelzuzek closed 1 year ago

axelzuzek commented 1 year ago

I tried to adapt the script for my Razer Deathadder V2 Pro

const RazerVendorId = 0x1532;
const TransactionId = 0x3f
const RazerProducts = {
    0x007D: {
        name: 'Razer DeathAdder V2 Pro (Wireless)',
        wireless: true
    },
    0x007C: {
        name: 'Razer DeathAdder V2 Pro (Wired)',
        wireless: true
    },
};

results in a Error: requestDevice error: Error: selected device not found

I tripple checked the Ids and transaction id, tried different USB ports.

then I started some testing

  usb = new WebUSB();
    usb.requestDevice({ filters: [{
        vendorId: RazerVendorId,
        productId: 0x0226, // razer huntsman elite      
    }] }).then(device => {
        console.log(device.productName);
        console.log(device.productId);
    }).catch(error => { console.error(error); });

outputs Razer Huntsman Elite 550

but

  usb = new WebUSB();
    usb.requestDevice({ filters: [{
        vendorId: RazerVendorId,
        //productId: 0x0226, // razer huntsman elite
        productId: 0x007D // razer deathadder v2 wireless

    }] }).then(device => {
        console.log(device.productName);
        console.log(device.productId);
    }).catch(error => { console.error(error); });

outputs nothing

is there anyone who made this work?

Tekk-Know commented 1 year ago

Can you try to remove the filter from usb.requestDevice() and break on the then() to see which devices it finds? That might inform on which devices it detects. Also possibly try usb.getDevices() and see what it outputs.

axelzuzek commented 1 year ago
    const webusb = new WebUSB({
        allowAllDevices: true
    });

    const showDevices = async () => {
        const devices = await webusb.getDevices();
        const text = devices.map(d => `${d.productName}\t${d.productId}`);
        text.unshift('productName\tPID\n-------------------------------------');
        console.log(text.join('\n'));
    };

    showDevices();

Outputs:

productName PID     
-------------------------------------
MYSTIC LIGHT    31889
LG Monitor Controls     39481
Razer Huntsman Elite    550

The mouse and many other devices are not found

axelzuzek commented 1 year ago

Update: my old Razer Lancehead (cable version) is found, the new Razer Deathadder V2 Pro is not found (no matter if wireless or cable connected)

Tekk-Know commented 1 year ago

Hmm yeah not 100% sure what the issue told l would be then. The USB lib had a legacy non-webusb method of communicating. You could try refactoring the code using that method.

Tekk-Know commented 1 year ago

Added support for DA 2 pro