Skip to content

Feature/get device by id without permission - #127

Merged
hugomontero merged 9 commits into
mainfrom
feature/get-device-by-id-without-permission
Aug 21, 2026
Merged

hugomontero merged 9 commits into
mainfrom
feature/get-device-by-id-without-permission

Conversation

@hugomontero

@hugomontero hugomontero commented Aug 12, 2026

Copy link
Copy Markdown
Contributor
  • Remove prompting permissions for web-usb getDevices.
  • Add a new method: requestDevice to grant usb permissions for an specific particle device.
  • openDeviceById, now will use serialNumber for an specific webusb device.

How to test:

Using a web project do:

import {  requestDevice, getDevices, openDeviceById } from 'particle-usb';
try {
		const devices = await getDevices();
		console.log('my devices', devices);
		const device = await requestDevice();
		console.log('my device', device);
		console.log('opening the first device', devices[0]);
		const openedDevice = await openDeviceById(devices[0].id);
		console.log(openedDevice);
	} catch (error) {
		console.log(error)
	}

outcome

  • getDevices will return a list of granted and connected particle devices
  • requestDevice will prompt you to pick a device to grant usb permissions to the browser
  • opendeviceById pick a device ( in this case from the list of devices) and it will open it and allow you to run commands thru the device.

@hugomontero
hugomontero requested review from monkbroc and removed request for monkbroc August 12, 2026 17:22
@hugomontero
hugomontero marked this pull request as draft August 14, 2026 15:11
@hugomontero
hugomontero force-pushed the feature/get-device-by-id-without-permission branch from d3a9faa to 95b7cee Compare August 16, 2026 17:59
Comment thread src/usb-device-webusb.js
@hugomontero
hugomontero requested review from monkbroc and sergeuz and removed request for monkbroc August 17, 2026 18:29
@hugomontero
hugomontero marked this pull request as ready for review August 17, 2026 18:33
@hugomontero
hugomontero force-pushed the feature/get-device-by-id-without-permission branch from b77ee7a to ca2b981 Compare August 18, 2026 17:56
@hugomontero
hugomontero force-pushed the feature/get-device-by-id-without-permission branch from 5501f3a to 8b84201 Compare August 21, 2026 16:15
@hugomontero
hugomontero merged commit 4e5c7e4 into main Aug 21, 2026
2 checks passed
@hugomontero
hugomontero deleted the feature/get-device-by-id-without-permission branch August 21, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants