Skip to content

Fix scanning on Linux#5

Open
leMaik wants to merge 4 commits intocarlipa:masterfrom
TeamWertarbyte:master
Open

Fix scanning on Linux#5
leMaik wants to merge 4 commits intocarlipa:masterfrom
TeamWertarbyte:master

Conversation

@leMaik
Copy link
Copy Markdown

@leMaik leMaik commented Oct 20, 2020

This PR fixes scanning not working on Linux (fixes #4), removes debug output and changes the json require calls to not use __dirname. require is always relative to the script's directory, so this isn't needed.

Background: I use this in an application that is bundled to an executable with pkg, which doesn't work for dynamic require calls.

PS: If someone needs this right now: npm i -S @wertarbyte/edid-reader

Comment thread src/index.js
getLinuxSystemEdids() {
// /sys/devices/pci0000\:00/0000\:00\:02.0/drm/card0/card0-HDMI-A-1/edid
return glob('/sys/devices/pci*/0000:*/drm/card*/card*/edid')
return glob('/sys/devices/pci*/0000:*/*/drm/card*/card*/edid')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For local usage I added changes you've added to fix the error, however this line causes glob to not match any files, not sure if you added it for a reason, but I removed it and only then it matched the files needed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's depending on the OS ?
@leMaik on which OS did you try this ?
The ** pattern can help in this case, to cover both possibilities.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this made it work on Ubuntu for me back then so… 🤷‍♂️ Maybe …/0000:**/drm/card… would work for both of us?

Copy link
Copy Markdown
Contributor

@lionep lionep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leMaik
I just tested it, it's of with the ** pattern, can you edit to :

return glob('/sys/devices/pci*/0000:*/**/drm/card*/card*/edid')

Comment thread src/index.js
getLinuxSystemEdids() {
// /sys/devices/pci0000\:00/0000\:00\:02.0/drm/card0/card0-HDMI-A-1/edid
return glob('/sys/devices/pci*/0000:*/drm/card*/card*/edid')
return glob('/sys/devices/pci*/0000:*/*/drm/card*/card*/edid')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's depending on the OS ?
@leMaik on which OS did you try this ?
The ** pattern can help in this case, to cover both possibilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: Unhandled rejection TypeError: expecting a function but got [object Undefined]

3 participants