Corsair_Virtuoso_XT_Headset.js aktualisiert

This commit is contained in:
s-mendyka 2024-07-26 22:13:14 +02:00
parent efc5969c24
commit fc32de2be1

View File

@ -1,11 +1,10 @@
export function Name() { return "Corsair Virtuoso Device"; }
export function Name() { return "Corsair Headset Device"; }
export function VendorId() { return 0x1B1C; }
export function ProductId() { return Object.keys(CORSAIRdeviceLibrary.PIDLibrary); }
export function Publisher() { return "WhirlwindFx"; }
export function Documentation(){ return "troubleshooting/corsair"; }
export function Size() { return [1, 1]; }
/* global
shutdownColor:readonly
LightingMode:readonly
forcedColor:readonly
micLedMode:readonly
@ -15,7 +14,6 @@ SidetoneAmount:readonly
*/
export function ControllableParameters() {
return [
{"property":"shutdownColor", "group":"lighting", "label":"Shutdown Color", "min":"0", "max":"360", "type":"color", "default":"#009bde"},
{"property":"LightingMode", "group":"lighting", "label":"Lighting Mode", "type":"combobox", "values":["Canvas", "Forced"], "default":"Canvas"},
{"property":"forcedColor", "group":"lighting", "label":"Forced Color", "min":"0", "max":"360", "type":"color", "default":"#009bde"},
{"property":"micLedMode", "group":"lighting", "label":"Microphone LED Mode", "type":"combobox", "values":["Canvas", "MuteState"], "default":"Canvas"},
@ -59,7 +57,7 @@ export class CORSAIR_Device_Protocol {
constructor() {
this.Config = {
DeviceProductID: 0x0000,
DeviceName: "Corsair Virtuoso Device",
DeviceName: "Corsair Headset Device",
DeviceEndpoint: { "interface": 0, "usage": 0x0000, "usage_page": 0x0000, "collection": 0x0000 },
LedNames: [],
LedPositions: [],
@ -136,7 +134,6 @@ export class CORSAIR_Device_Protocol {
);
this.modernDirectLightingMode();
this.fetchBattery();
}
modernDirectLightingMode() {
@ -165,6 +162,7 @@ export class CORSAIR_Device_Protocol {
sendColors(overrideColor) {
const deviceLedPositions = this.getLedPositions();
const deviceLedNames = this.getLedNames();
const deviceLeds = this.getLeds();
const RGBData = [];
@ -173,7 +171,7 @@ export class CORSAIR_Device_Protocol {
const iPxY = deviceLedPositions[iIdx][1];
let color;
if(deviceLeds[iIdx] === 2 && micLedMode === "MuteState"){
if(deviceLedNames[iIdx] === "Mic" && micLedMode === "MuteState"){
const micState = this.fetchMicStatus();
if (micState === 1) {
@ -212,10 +210,11 @@ export class CORSAIR_Device_Protocol {
}
const headsetMode = this.getWirelessSupport() === true ? 0x09 : 0x08;
const micreadMode = this.getDeviceName().includes("HS80") === true ? 0xA6 : 0x46;
const endpoint = this.getDeviceEndpoint();
device.set_endpoint(endpoint[`interface`], endpoint[`usage`], endpoint[`usage_page`]);
const micStatusPacket = [0x02, headsetMode, 0x02, 0x46, 0x00];
const micStatusPacket = [0x02, headsetMode, 0x02, micreadMode, 0x00];
device.pause(100);
device.clearReadBuffer();
@ -225,7 +224,7 @@ export class CORSAIR_Device_Protocol {
const micStatus = device.read(micStatusPacket, 64); // Index 5 returns 0 to unmutted/enable and 1 to muted/disabled
this.Config.lastMicStatePolling = Date.now();
if (micStatus[3] === 0x46) {
if (micStatus[3] === micreadMode) {
console.log("Invalid read on mic status.");
return this.Config.lastMicState;
@ -326,30 +325,211 @@ export class CORSAIR_Device_Protocol {
export class deviceLibrary {
constructor(){
this.PIDLibrary = {
0x0A43: "Virtuoso",
0x0A42: "Virtuoso",
0x0A41: "Virtuoso",
0x0A44: "Virtuoso",
0x0A40: "Virtuoso",
0x0A4B: "Virtuoso",
0x0A4C: "Virtuoso",
0x0A5C: "Virtuoso",
0x0A3D: "Virtuoso SE",
0x0A3E: "Virtuoso SE",
0x0A34: "Virtuoso SE",
0x0A62: "Virtuoso XT",
0x0A64: "Virtuoso XT", // Wireless
0x0A69: "HS80",
//0x0A6A: "HS80", // PID for wired WHILE wireless dongle plugged in, doesnt control the headset
0x0A6B: "HS80",
0x0A71: "HS80", //White
0x0A73: "HS80", //White
};
this.LEDLibrary = {
// Virtuoso Standard
0x0A43: {
name: "Virtuoso",
size: [3, 3],
LedNames: ["Left Cans", "Right Can", "Mic"],
LedPositions: [[0, 2], [2, 2], [1, 0]],
Leds: [0, 1, 2],
endpoint : { "interface": 4, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0004 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/virtuoso-standard.png"
},
0x0A42: {
name: "Virtuoso Wireless",
size: [3, 3],
LedNames: ["Left Cans", "Right Can", "Mic"],
LedPositions: [[0, 2], [2, 2], [1, 0]],
Leds: [0, 1, 2],
wireless: true,
endpoint : { "interface": 4, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0004 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/virtuoso-standard.png"
},
0x0A41: {
name: "Virtuoso Wireless",
size: [3, 3],
LedNames: ["Left Cans", "Right Can", "Mic"],
LedPositions: [[0, 2], [2, 2], [1, 0]],
Leds: [0, 1, 2],
wireless: true,
endpoint : { "interface": 4, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0004 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/virtuoso-standard.png"
},
0x0A44: {
name: "Virtuoso Wireless",
size: [3, 3],
LedNames: ["Left Cans", "Right Can", "Mic"],
LedPositions: [[0, 2], [2, 2], [1, 0]],
Leds: [0, 1, 2],
wireless: true,
endpoint : { "interface": 4, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0004 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/virtuoso-standard.png"
},
0x0A40: {
name: "Virtuoso Wireless",
size: [3, 3],
LedNames: ["Left Cans", "Right Can", "Mic"],
LedPositions: [[0, 2], [2, 2], [1, 0]],
Leds: [0, 1, 2],
wireless: true,
endpoint : { "interface": 4, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0004 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/virtuoso-standard.png"
},
0x0A4B: {
name: "Virtuoso Wireless",
size: [3, 3],
LedNames: ["Left Cans", "Right Can", "Mic"],
LedPositions: [[0, 2], [2, 2], [1, 0]],
Leds: [0, 1, 2],
wireless: true,
endpoint : { "interface": 4, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0004 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/virtuoso-standard.png"
},
0x0A4C: {
name: "Virtuoso Wireless",
size: [3, 3],
LedNames: ["Left Cans", "Right Can", "Mic"],
LedPositions: [[0, 2], [2, 2], [1, 0]],
Leds: [0, 1, 2],
wireless: true,
endpoint : { "interface": 4, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0004 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/virtuoso-standard.png"
},
0x0A5C: {
name: "Virtuoso Wireless",
size: [3, 3],
LedNames: ["Left Cans", "Right Can", "Mic"],
LedPositions: [[0, 2], [2, 2], [1, 0]],
Leds: [0, 1, 2],
wireless: true,
endpoint : { "interface": 4, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0004 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/virtuoso-standard.png"
},
// Virtuoso SE
0x0A3D: {
name: "Virtuoso SE",
size: [3, 3],
LedNames: ["Left Cans", "Right Can", "Mic"],
LedPositions: [[0, 2], [2, 2], [1, 0]],
Leds: [0, 1, 2],
endpoint : { "interface": 4, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0004 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/virtuoso-se.png"
},
0x0A3E: {
name: "Virtuoso SE Wireless",
size: [3, 3],
LedNames: ["Left Cans", "Right Can", "Mic"],
LedPositions: [[0, 2], [2, 2], [1, 0]],
Leds: [0, 1, 2],
wireless: true,
endpoint : { "interface": 3, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0004 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/virtuoso-se.png"
},
0x0A346: { // NEED TO CONFIRM
name: "Virtuoso SE Wireless",
size: [3, 3],
LedNames: ["Left Cans", "Right Can", "Mic"],
LedPositions: [[0, 2], [2, 2], [1, 0]],
Leds: [0, 1, 2],
wireless: true,
endpoint : { "interface": 4, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0005 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/virtuoso-se.png"
},
// Virtuoso XT
0x0A62: {
name: "Virtuoso XT",
size: [1, 2],
LedNames: ["Logo", "Mic"],
LedPositions: [[0, 0], [0, 1]],
Leds: [0, 2],
size: [3, 3],
LedNames: ["Logo", "Power", "Mic"],
LedPositions: [[1, 0], [0, 2], [2, 2]],
Leds: [0, 1, 2],
endpoint : { "interface": 3, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0005 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/virtuoso-xt.png"
},
0x0A64: {
name: "Virtuoso XT Wireless",
size: [1, 2],
LedNames: ["Logo", "Mic"],
LedPositions: [[0, 0], [0, 1]],
Leds: [0, 2],
size: [3, 3],
LedNames: ["Logo", "Power", "Mic"],
LedPositions: [[1, 0], [0, 2], [2, 2]],
Leds: [0, 1, 2],
wireless: true,
endpoint : { "interface": 3, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0005 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/virtuoso-xt.png"
},
// HS80
/*
0x0A6A: { // PID for wired WHILE wireless dongle plugged in
name: "HS80 RGB",
size: [3, 3],
LedNames: ["Logo", "Power", "Mic"],
LedPositions: [[1, 0], [0, 2], [2, 2]],
Leds: [0, 1, 2],
endpoint : { "interface": 0, "usage": 0x0001, "usage_page": 0xFF58, "collection": 0x0001 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/hs80.png"
},
*/
0x0A69: {
name: "HS80 RGB",
size: [3, 3],
LedNames: ["Logo", "Power", "Mic"],
LedPositions: [[1, 0], [0, 2], [2, 2]],
Leds: [0, 1, 2],
endpoint : { "interface": 3, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0004 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/hs80.png"
},
0x0A6B: {
name: "HS80 RGB Wireless",
size: [3, 3],
LedNames: ["Logo", "Power", "Mic"],
LedPositions: [[1, 0], [0, 2], [2, 2]],
Leds: [0, 1, 2],
wireless: true,
endpoint : { "interface": 3, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0004 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/hs80.png"
},
0x0A71: {
name: "HS80 RGB White",
size: [3, 3],
LedNames: ["Logo", "Power", "Mic"],
LedPositions: [[1, 0], [0, 2], [2, 2]],
Leds: [0, 1, 2],
endpoint : { "interface": 3, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0004 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/hs80.png"
},
0x0A73: { //White
name: "HS80 RGB White Wireless",
size: [3, 3],
LedNames: ["Logo", "Power", "Mic"],
LedPositions: [[1, 0], [0, 2], [2, 2]],
Leds: [0, 1, 2],
wireless: true,
endpoint : { "interface": 3, "usage": 0x0001, "usage_page": 0xFF42, "collection": 0x0005 },
image: "https://assets.signalrgb.com/devices/brands/corsair/audio/hs80.png"
},
};
}
}
@ -368,7 +548,7 @@ function hexToRgb(hex) {
}
export function Validate(endpoint) {
return endpoint.interface === 3;
return endpoint.interface === 0 || endpoint.interface === 3 || endpoint.interface === 4;
}
export function ImageUrl() {