Skip to content

Commit

Permalink
Merge pull request #9 from richrace/add-more-debugging
Browse files Browse the repository at this point in the history
Add more debugging
  • Loading branch information
richrace authored Aug 29, 2023
2 parents afc04b4 + 23b192e commit 9946ef3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"typescript": "^5.0.4"
},
"dependencies": {
"arctis-usb-finder": "^0.0.15",
"arctis-usb-finder": "^0.0.16",
"electron-squirrel-startup": "^1.0.0"
}
}
26 changes: 22 additions & 4 deletions src/menu_items/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import ProbeResult from 'arctis-usb-finder/dist/interfaces/probe_result';
import UsbDevice from 'arctis-usb-finder/dist/interfaces/usb_device';
import Probe from 'arctis-usb-finder/dist/use_cases/probe';

import { MenuItem } from 'electron';
import { MenuItem, clipboard } from 'electron';

function debugMenu(): MenuItem {
const probe = new Probe();
Expand Down Expand Up @@ -37,13 +37,31 @@ function debugMenu(): MenuItem {

if (foundHeadphones.length > 0) {
probeMenuItems = foundHeadphones.reduce((menuItems, result: ProbeResult) => {
const path = result.device.path();

menuItems.push({
label: result.device.realDevice().product,
submenu: [
{ label: `Product ID: ${result.device.productId}` },
{ label: `Bytes: ${result.matchedBytes}` },
{ label: `Report: ${result.matchedReport}` },
{ label: `Path: ${result.device.path()}` },
{
label: `Bytes: ${result.matchedBytes}`,
click: () => {
clipboard.writeText(`Bytes: ${result.matchedBytes}`);
},
},
{
label: `Report: ${result.matchedReport}`,
click: () => {
clipboard.writeText(`Report: ${result.matchedReport}`);
},
},
{
label: `Path: ${path.slice(0, 50)}...`,
toolTip: `Path: ${path}`,
click: () => {
clipboard.writeText(`Path: ${path}`);
},
},
],
});

Expand Down

0 comments on commit 9946ef3

Please sign in to comment.