Skip to content

Commit

Permalink
Merge pull request #24 from julianitow/main
Browse files Browse the repository at this point in the history
Add support for Arctis 7P
  • Loading branch information
richrace authored Apr 24, 2024
2 parents 745a4f6 + 705dacb commit 79b41ef
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Finds known Arctis headsets that are currently plugged in via the USB dongle.
* Arctis Nova 7
* Arctis Nova 7X
* Arctis Nova 7P
* Arctis 7P

See [Probe](#probe) for how to get find new devices.

Expand Down
1 change: 1 addition & 0 deletions src/headphone_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const list: KnownHeadphone[] = [
new KnownHeadphone('Arctis 1 Wireless', KnownHeadphone.Arctis1W_ProductID, [0x06, 0x12], 0xff43, 0x202, 0x03, 3, 4),
new KnownHeadphone('Arctis 1 Xbox', KnownHeadphone.Arctis1X_ProductID, [0x06, 0x12], 0xff43, 0x202, 0x03, 3, 4),
new KnownHeadphone('Arctis 7X', KnownHeadphone.Arctis7X_ProductID, [0x06, 0x12], 0xff43, 0x202, 0x03, 3, 4, 5),
new KnownHeadphone('Arctis 7P', KnownHeadphone.Arctis7P_ProductID, [0x06, 0x12], 0xff43, 0x0202, 3, 3, 4),

new KnownHeadphone('Arctis 7 Plus', KnownHeadphone.Arctis7_Plus_ProductID, [0x00, 0xb0], 0xffc0, 0x1, 3, 2, 3),
new KnownHeadphone('Arctis 7P Plus', KnownHeadphone.Arctis7P_Plus_ProductID, [0x00, 0xb0], 0xffc0, 0x1, 3, 2, 3),
Expand Down
6 changes: 1 addition & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class ArctisUsbFinder {

simpleHeadphones(): SimpleHeadphone[] {
const simpleBuilder = new BuildSimpleHeadphones();

return simpleBuilder.execute(this.devices);
}

Expand All @@ -34,9 +33,7 @@ class ArctisUsbFinder {
report: [],
headphone: HeadphoneList.find((headphone) => {
const result = hidDevice.vendorId === headphone.vendorId && hidDevice.productId === headphone.productId;

if (result === false) return false;

if (!result) return false;
if (headphone.usagePage !== 0 && headphone.usage !== 0) {
return (
hidDevice.usagePage === headphone.usagePage &&
Expand All @@ -52,7 +49,6 @@ class ArctisUsbFinder {
.filter((hash) => {
if (hash.headphone) {
hash.headphone.path = hash.hidDevice.path;

return true;
}
});
Expand Down
1 change: 1 addition & 0 deletions src/models/known_headphone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default class KnownHeadphone {
static Arctis1W_ProductID = 0x12b3;
static Arctis1X_ProductID = 0x12b6;
static Arctis7X_ProductID = 0x12d7;
static Arctis7P_ProductID = 0x12d5;

static Arctis9_ProductID = 0x12c2;

Expand Down
1 change: 1 addition & 0 deletions src/use_cases/headsets/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default class Builder {
const knownHeadphone = deviceHash.headphone as KnownHeadphone;

switch (knownHeadphone.productId) {
case KnownHeadphone.Arctis7P_ProductID:
case KnownHeadphone.Arctis7X_ProductID:
case KnownHeadphone.Arctis1W_ProductID:
case KnownHeadphone.Arctis1X_ProductID:
Expand Down
2 changes: 0 additions & 2 deletions src/use_cases/headsets/map_battery_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default class MapBatteryBuilder implements SpecificBuilder {
let isCharging, isDischarging, isConnected;

const batteryPercent = calculateBattery(report[knownHeadphone.batteryPercentIdx]);

if (knownHeadphone.chargingStatusIdx) {
switch (report[knownHeadphone.chargingStatusIdx]) {
case 0: // Not Connected
Expand All @@ -28,7 +27,6 @@ export default class MapBatteryBuilder implements SpecificBuilder {
break;
}
}

return { batteryPercent, isCharging, isDischarging, isConnected } as SimpleHeadphone;
}
}

0 comments on commit 79b41ef

Please sign in to comment.