node-raspberrypi-usbboot
Advanced tools
Comparing version 0.2.10 to 0.3.0-cm4-7efa96d669767b6fc83d4506d154debcac4a6801
@@ -105,2 +105,3 @@ "use strict"; | ||
const USB_PRODUCT_ID_BCM2710_BOOT = 0x2764; | ||
const USB_PRODUCT_ID_BCM2711_BOOT = 0x2711; | ||
// When the pi reboots in mass storage mode, it has this product id | ||
@@ -166,3 +167,4 @@ const USB_VENDOR_ID_NETCHIP_TECHNOLOGY = 0x0525; | ||
(idProduct === USB_PRODUCT_ID_BCM2708_BOOT || | ||
idProduct === USB_PRODUCT_ID_BCM2710_BOOT)); | ||
idProduct === USB_PRODUCT_ID_BCM2710_BOOT || | ||
idProduct === USB_PRODUCT_ID_BCM2711_BOOT)); | ||
}; | ||
@@ -254,6 +256,9 @@ exports.isUsbBootCapableUSBDevice = isUsbBootCapableUSBDevice; | ||
}; | ||
const getFileBuffer = async (filename) => { | ||
const getFileBuffer = async (device, filename) => { | ||
let buffer = await safeReadFile(filename); | ||
if (buffer === undefined) { | ||
buffer = await safeReadFile(Path.join('raspberrypi', filename)); | ||
const folder = device.deviceDescriptor.idProduct === USB_PRODUCT_ID_BCM2711_BOOT | ||
? 'cm4' | ||
: 'raspberrypi'; | ||
buffer = await safeReadFile(Path.join(folder, filename)); | ||
} | ||
@@ -292,3 +297,3 @@ if (buffer === undefined) { | ||
const secondStageBoot = async (device, endpoint) => { | ||
const bootcodeBuffer = await getFileBuffer('bootcode.bin'); | ||
const bootcodeBuffer = await getFileBuffer(device, 'bootcode.bin'); | ||
if (bootcodeBuffer === undefined) { | ||
@@ -471,3 +476,3 @@ throw new Error("Can't find bootcode.bin"); | ||
message.command === FileMessageCommand.ReadFile) { | ||
const buffer = await getFileBuffer(message.filename); | ||
const buffer = await getFileBuffer(device, message.filename); | ||
if (buffer === undefined) { | ||
@@ -474,0 +479,0 @@ debug(`Couldn't find ${message.filename}`, devicePortId(device)); |
@@ -7,2 +7,7 @@ # Change Log | ||
# v0.3.0 | ||
## (2020-12-08) | ||
* Add support for compute module 4 [Alexis Svinartchouk] | ||
# v0.2.10 | ||
@@ -9,0 +14,0 @@ ## (2020-11-30) |
{ | ||
"name": "node-raspberrypi-usbboot", | ||
"version": "0.2.10", | ||
"version": "0.3.0-cm4-7efa96d669767b6fc83d4506d154debcac4a6801", | ||
"description": "Transforms Raspberry Pi Compute Modules and Zeros to mass storage devices.", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
28222586
25
538
16