Socket
Socket
Sign inDemoInstall

linux-device

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linux-device - npm Package Compare versions

Comparing version 1.0.10 to 1.0.11

2

lib/DeviceHandle.js

@@ -5,3 +5,3 @@ var DeviceHandle = require('bindings')('DeviceHandle').DeviceHandle;

DeviceHandle.prototype.gpio = function(gpio, value, cb) {
DeviceHandle.gpio = DeviceHandle.prototype.gpio = function(gpio, value, cb) {
cb = cb || function(){};

@@ -8,0 +8,0 @@

{
"name": "linux-device",
"version": "1.0.10",
"version": "1.0.11",
"description": "Native addon to communicate with linux devices (can also be used for sockets or FIFOs)",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -63,2 +63,8 @@ "use strict";

metadata.static_functions.forEach((func) => {
DeviceHandleProxy[func] = function() {
server.then(serv => serv.emit.bind(serv, 'static_'+func).apply(null, arguments));
};
});
metadata.constants.forEach((c, index) => {

@@ -65,0 +71,0 @@ DeviceHandleProxy[c] = c;

{
"functions": ["write", "ioctl", "ioctl_raw", "close", "gpio"],
"static_functions": ["gpio"],
"constants": ["IOCTL_NONE","IOCTL_READ","IOCTL_WRITE","IOCTL_RW"]
}

@@ -54,2 +54,15 @@ "use strict";

metadata.static_functions.forEach((name) => {
if(blacklist.indexOf(name) >= 0) return;
socket.on('static_'+name, function() {
let args = Array.prototype.slice.apply(arguments);
console.log('static', name, arguments);
try {
DeviceHandle[name].apply(null, arguments);
} catch(e) {
socket.emit('server_error', e && e.stack ? e.stack : e);
}
});
});
socket.on('ioctl', (path, dir, type, cmd, data) => {

@@ -56,0 +69,0 @@ dir = DeviceHandle[dir];

@@ -5,3 +5,3 @@ "use strict";

let input = new DH('/dev/input/by-path/platform-gpio_keys-event',false,16,console.log);
input.gpio(58, 0, console.log.bind(0,'gpio cb'));
DH.gpio(58, 0, console.log.bind(0,'gpio cb'));

@@ -8,0 +8,0 @@ setTimeout(() => {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc