Skip to content

Commit

Permalink
feat: adding support for device_tree_path in rpio.init to fix jperkin…
Browse files Browse the repository at this point in the history
…#154 rather than assume /proc/device-tree/model

This allows non privileged docker containers to specify a different path for the model file since it can't use /proc/device-tree/model
  • Loading branch information
masahji authored and MarkvanderPol committed Apr 5, 2024
1 parent dbafe94 commit cec77be
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/rpio.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ var rpio_options = {
gpiomem: true,
mapping: 'physical',
mock: false,
close_on_exit: true
close_on_exit: true,
device_tree_path: '/proc/device-tree/model',
};

/* Default mock mode if hardware is unsupported. */
Expand Down Expand Up @@ -539,7 +540,7 @@ function detect_pinmap()
var model;

try {
model = fs.readFileSync('/proc/device-tree/model', 'ascii');
model = fs.readFileSync(rpio_options.device_tree_path, 'ascii');
model = model.replace(/\0+$/, '');
} catch (err) {
return false;
Expand Down

0 comments on commit cec77be

Please sign in to comment.