Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-raspberrypi-usbboot

Package Overview
Dependencies
Maintainers
3
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-raspberrypi-usbboot - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10-fix-multiple-devices-bfbce42a9875996fb7c6109d2fff17fcc78093dc

21

build/index.js

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

Object.defineProperty(exports, "__esModule", { value: true });
const async_mutex_1 = require("async-mutex");
const bluebird_1 = require("bluebird");

@@ -22,2 +23,3 @@ const _debug = require("debug");

const usb = require("usb");
const mutex = new async_mutex_1.Mutex();
const readFile = bluebird_1.promisify(fs_1.readFile);

@@ -172,3 +174,3 @@ const debug = _debug('node-raspberrypi-usbboot');

const endpoint = iface.endpoint(endpointNumber);
debug('Initialized device correctly');
debug('Initialized device correctly', portId(device));
return { iface, endpoint };

@@ -180,2 +182,3 @@ };

const epWrite = (buffer, device, endpoint) => __awaiter(this, void 0, void 0, function* () {
const release = yield mutex.acquire();
yield sendSize(device, buffer.length);

@@ -187,2 +190,3 @@ if (buffer.length > 0) {

}
release();
});

@@ -245,3 +249,3 @@ const epRead = (device, bytesToRead) => __awaiter(this, void 0, void 0, function* () {

yield epWrite(bootMessage, device, endpoint);
debug(`Writing ${bootMessage.length} bytes`);
debug(`Writing ${bootMessage.length} bytes`, portId(device));
yield epWrite(bootcodeBuffer, device, endpoint);

@@ -348,3 +352,3 @@ // raspberrypi's sample code has a sleep(1) here, but it looks like it isn't required.

if (device.deviceDescriptor.iSerialNumber === 0) {
debug('Sending bootcode.bin');
debug('Sending bootcode.bin', portId(device));
this.step(device, 0);

@@ -356,3 +360,3 @@ yield secondStageBoot(device, endpoint);

else {
debug('Second stage boot server');
debug('Second stage boot server', portId(device));
yield this.fileServer(device, endpoint, 2);

@@ -363,2 +367,3 @@ }

catch (error) {
debug('error', error, portId(device));
this.remove(device);

@@ -372,4 +377,4 @@ }

}
debug('detach', portId(device));
const step = (device.deviceDescriptor.iSerialNumber === 0) ? 1 : 40;
debug('detach', portId(device), step);
this.step(device, step);

@@ -404,7 +409,7 @@ // This timeout is here to differentiate between the device resetting and the device being unplugged

const message = parseFileMessageBuffer(data);
debug('Received message', FileMessageCommand[message.command], message.filename);
debug('Received message', FileMessageCommand[message.command], message.filename, portId(device));
if ((message.command === FileMessageCommand.GetFileSize) || (message.command === FileMessageCommand.ReadFile)) {
const buffer = yield getFileBuffer(message.filename);
if (buffer === undefined) {
debug(`Couldn't find ${message.filename}`);
debug(`Couldn't find ${message.filename}`, portId(device));
yield sendSize(device, 0);

@@ -425,3 +430,3 @@ }

}
debug('File server done');
debug('File server done', portId(device));
});

@@ -428,0 +433,0 @@ }

@@ -7,2 +7,7 @@ # Change Log

## v0.0.10 - 2018-10-18
* Add a mutex around epWrite. [Alexis Svinartchouk]
* Add the usb port id to each debug message [Alexis Svinartchouk]
## v0.0.9 - 2018-10-10

@@ -9,0 +14,0 @@

{
"name": "node-raspberrypi-usbboot",
"version": "0.0.9",
"version": "0.0.10-fix-multiple-devices-bfbce42a9875996fb7c6109d2fff17fcc78093dc",
"description": "Transforms Raspberry Pi Compute Modules and Zeros to mass storage devices.",

@@ -28,2 +28,3 @@ "main": "build/index.js",

"@types/node": "^6.0.112",
"async-mutex": "^0.1.3",
"debug": "^3.1.0",

@@ -30,0 +31,0 @@ "usb": "github:resin-io/node-usb#1.3.5"

Sorry, the diff of this file is not supported yet

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