Skip to content

Commit

Permalink
fix: disconnects not working on tablets (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
sverben authored Feb 18, 2025
1 parent 6c400ec commit 9249c27
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@leaphy-robotics/dfu-util-wasm": "^1.0.2",
"@leaphy-robotics/leaphy-blocks": "3.3.3",
"@leaphy-robotics/picotool-wasm": "1.0.3",
"@leaphy-robotics/webusb-ftdi": "1.0.2",
"@leaphy-robotics/webusb-ftdi": "1.0.3",
"@sentry/svelte": "^8.34.0",
"@types/w3c-web-usb": "^1.0.10",
"@xterm/addon-fit": "^0.10.0",
Expand Down
7 changes: 4 additions & 3 deletions src/lib/state/serial.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,16 @@ class SerialState {
const port = await this.requestPort(prompt);
if (this.port === port) return this.onReady();

if ("addEventListener" in port) {
port.addEventListener("disconnect", async () => {
this.port = this.getLeaphyPort(port);
if ("addEventListener" in this.port) {
this.port.addEventListener("disconnect", async () => {
this.reserved = false;
this.port = undefined;
this.board = undefined;
this.onFailure();
});
}
this.port = this.getLeaphyPort(port);

this.board = this.detectBoard(port);

return port;
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,10 @@
dependencies:
serialport "^12.0.0"

"@leaphy-robotics/[email protected].2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@leaphy-robotics/webusb-ftdi/-/webusb-ftdi-1.0.2.tgz#1d84826b6b3823f5dc62d70aceb15e100972d9c8"
integrity sha512-8u34rfbkgk+BsYd2/SgRozTIm1cZO+pHZYxg27d+FhWyJEgTSMsZ7xdrRLptOOj9BtOGYACXPo9MDI1Wf9QIRQ==
"@leaphy-robotics/[email protected].3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@leaphy-robotics/webusb-ftdi/-/webusb-ftdi-1.0.3.tgz#befe4d60479c3ffc4c13a61be16f866ccef29623"
integrity sha512-9j3cGGsT7M0k5Y9rl7xnm9/TqRDSbC5LRBEC88MMntNDpoV1rBB9HKLXGiTZV26161Qmm2xhquEuVzG1RQkryA==

"@nodelib/[email protected]":
version "2.1.5"
Expand Down

0 comments on commit 9249c27

Please sign in to comment.