mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-25 12:16:37 +00:00
usbboot: Add more logging
Change-type: patch Signed-off-by: Juan Cruz Viotti <juan@balena.io>
This commit is contained in:
parent
7c4eb19748
commit
389e9b14e4
@ -419,6 +419,7 @@ class USBBootAdapter extends EventEmitter {
|
|||||||
const endpoint = deviceInterface.endpoint(addresses.endpoint)
|
const endpoint = deviceInterface.endpoint(addresses.endpoint)
|
||||||
|
|
||||||
if (serialNumberIndex === USB_DESCRIPTOR_NULL_INDEX) {
|
if (serialNumberIndex === USB_DESCRIPTOR_NULL_INDEX) {
|
||||||
|
debug('Writing boot code')
|
||||||
return this.queryBlobFromCache(USBBOOT_BOOTCODE_FILE_NAME).then((bootcode) => {
|
return this.queryBlobFromCache(USBBOOT_BOOTCODE_FILE_NAME).then((bootcode) => {
|
||||||
return USBBootAdapter.writeBootCode(device, endpoint, bootcode)
|
return USBBootAdapter.writeBootCode(device, endpoint, bootcode)
|
||||||
})
|
})
|
||||||
@ -441,6 +442,7 @@ class USBBootAdapter extends EventEmitter {
|
|||||||
setProgress((step * (PERCENTAGE_TOTAL - PERCENTAGE_START) / STEPS_TOTAL) + PERCENTAGE_START)
|
setProgress((step * (PERCENTAGE_TOTAL - PERCENTAGE_START) / STEPS_TOTAL) + PERCENTAGE_START)
|
||||||
}
|
}
|
||||||
}).tap(() => {
|
}).tap(() => {
|
||||||
|
debug('File server started')
|
||||||
setProgress(utils.PERCENTAGE_MAXIMUM)
|
setProgress(utils.PERCENTAGE_MAXIMUM)
|
||||||
})
|
})
|
||||||
}).return(device).catch({
|
}).return(device).catch({
|
||||||
|
@ -232,16 +232,22 @@ const chunks = function *(buffer, size) {
|
|||||||
* })
|
* })
|
||||||
*/
|
*/
|
||||||
exports.write = (device, endpoint, buffer) => {
|
exports.write = (device, endpoint, buffer) => {
|
||||||
|
console.log(`SEND BUFFER SIZE: ${buffer.length}`)
|
||||||
return exports.sendBufferSize(device, buffer.length)
|
return exports.sendBufferSize(device, buffer.length)
|
||||||
|
.then(() => {
|
||||||
|
console.log(`BUFFER SIZE SENT: ${buffer.length}`)
|
||||||
|
})
|
||||||
|
|
||||||
// We get LIBUSB_TRANSFER_STALL sometimes
|
// We get LIBUSB_TRANSFER_STALL sometimes
|
||||||
// in future bulk transfers without this
|
// in future bulk transfers without this
|
||||||
.delay(USB_REQUEST_DELAY_MS)
|
.delay(USB_REQUEST_DELAY_MS)
|
||||||
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
console.log(`SENDING CHUNKS: ${buffer.length} (max ${ONE_MEGABYTE})`)
|
||||||
endpoint.timeout = USB_BULK_TRANSFER_TIMEOUT_MS
|
endpoint.timeout = USB_BULK_TRANSFER_TIMEOUT_MS
|
||||||
return Bluebird.each(chunks(buffer, ONE_MEGABYTE), (chunk) => {
|
return Bluebird.each(chunks(buffer, ONE_MEGABYTE), (chunk) => {
|
||||||
return Bluebird.fromCallback((callback) => {
|
return Bluebird.fromCallback((callback) => {
|
||||||
|
console.log(`SENDING CHUNK: ${chunk.length}`)
|
||||||
endpoint.transfer(chunk, callback)
|
endpoint.transfer(chunk, callback)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -74,6 +74,11 @@ exports.listDevices = () => {
|
|||||||
return device
|
return device
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.log(devices.map((device) => {
|
||||||
|
const descriptor = device.deviceDescriptor
|
||||||
|
return `${descriptor.idVendor.toString(16)}:${descriptor.idProduct.toString(16)}`
|
||||||
|
}))
|
||||||
|
|
||||||
// Include driverless devices into the list of USB devices.
|
// Include driverless devices into the list of USB devices.
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
// NOTE: Temporarily ignore errors when loading winusb-driver-generator,
|
// NOTE: Temporarily ignore errors when loading winusb-driver-generator,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user