Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scanning on Linux #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

leMaik
Copy link

@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

@@ -59,7 +59,7 @@ class EdidReader {
// Linux fetch EDID
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')

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
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
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
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')

@@ -59,7 +59,7 @@ class EdidReader {
// Linux fetch EDID
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
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