>
https://rtestardi.github.io/usbte/flea-scope.html Gives no compatible devices found
Did you have a Flea-Scope?
That (flea-scope.html) webpage filters via USB VID/PID to only show "compatible" devices, i.e., Flea-Scopes.
Notice the "filters" in the code at the bottom of this post -- those are the Flea-Scope VID/PIDs (only one of which is used now, the last one).
Also, if a higher level driver has already claimed the device (like the serial driver claiming a CDC/ACM port), then you won't be able to claim it with WebUSB -- since only one driver can own a device.
This is why if a serial driver exists on the platform, you have to use Web Serial instead of WebUSB.
Lots of intro is here:
https://rtestardi.github.io/usbte/gadget.pdfCode:
[Select]// the user wants to connect to a USB device's bulk endpoints directly
async function Usb()
{
var filter = [
{ vendorId: 0x0403, productId: 0xA660 },
{ vendorId: 0x1b4f, productId: 0xA660 },
{ vendorId: 0x1b4f, productId: 0xE66E },
{ vendorId: 0x04D8, productId: 0xE66E },
];
usb = undefined;
comm = undefined;
reader = undefined;
writer = undefined;
if ('usb' in navigator) {
try {
usb = await navigator.usb.requestDevice({ filters: filter });
await usb.open();
await usb.selectConfiguration(1);
await usb.claimInterface(1);
document.getElementById("config").hidden = true;
document.getElementById("help").hidden = true;
document.getElementById("canvas").hidden = false;
discard = 1;
setTimeout(Receive, 1);
Send(String.fromCharCode(3)); // Ctrl-C
await new Promise(r => setTimeout(r, 200)); // allow autorun program to stop?
Send("echo off\n"); // XXX -- figure out how to undo?
Send("prompt off\n"); // XXX -- figure out how to undo?
Send("dim unused[8] as flash\n");
Send("dim cal_zero_x1 as flash, cal_3v3_x1 as flash\n");
Send("dim cal_zero_x10 as flash, cal_3v3_x10 as flash\n");
Wave();
discarded = false;
setTimeout(Discard, 200);
} catch(err) {
document.getElementById("help").innerHTML += "<p><font color='red'>" + err.message.replace(/</g,'<').replace(/>/g,'>') + "</font></p>";
}
} else {
document.getElementById("help").innerHTML += "<p><font color='red'>WebUSB API not found.</font></p>";
}
}
// the user wants to connect to an emulated COM port
async function Comm()
{
var filter = [
{ usbVendorId: 0x0403, usbProductId: 0xA660 },
{ usbVendorId: 0x1b4f, usbProductId: 0xA660 },
{ usbVendorId: 0x1b4f, usbProductId: 0xE66E },
{ usbVendorId: 0x04D8, usbProductId: 0xE66E },
];
usb = undefined;
comm = undefined;
reader = undefined;
writer = undefined;
if ('serial' in navigator) {
try {
comm = await navigator.serial.requestPort({ filters: filter });
await comm.open({ baudRate: 115200, bufferSize: bytes });
reader = comm.readable.getReader();
writer = comm.writable.getWriter();
document.getElementById("config").hidden = true;
document.getElementById("help").hidden = true;
document.getElementById("canvas").hidden = false;
discard = 1;
setTimeout(Receive, 1);
Send(String.fromCharCode(3)); // Ctrl-C
await new Promise(r => setTimeout(r, 200)); // allow autorun program to stop?
Send("echo off\n"); // XXX -- figure out how to undo?
Send("prompt off\n"); // XXX -- figure out how to undo?
Send("dim unused[8] as flash\n");
Send("dim cal_zero_x1 as flash, cal_3v3_x1 as flash\n");
Send("dim cal_zero_x10 as flash, cal_3v3_x10 as flash\n");
Wave();
discarded = false;
setTimeout(Discard, 200);
} catch(err) {
document.getElementById("help").innerHTML += "<p><font color='red'>" + err.message.replace(/</g,'<').replace(/>/g,'>') + "</font></p>";
}
} else {
document.getElementById("help").innerHTML += "<p><font color='red'>Web Serial API not found.</font></p>";
}
}