Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 70dd3418 authored by Simon Chan's avatar Simon Chan
Browse files

feat(usb): generate serial numbers for devices without it

parent d82e7450
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -280,8 +280,9 @@ export class AdbDaemonWebUsbDevice implements AdbDaemonDevice {
        return this.#raw;
    }

    #serial: string;
    get serial(): string {
        return this.#raw.serialNumber!;
        return this.#serial;
    }

    get name(): string {
@@ -300,6 +301,14 @@ export class AdbDaemonWebUsbDevice implements AdbDaemonDevice {
        usbManager: USB,
    ) {
        this.#raw = device;
        if (device.serialNumber) {
            this.#serial = device.serialNumber;
        } else {
            this.#serial =
                device.vendorId.toString(16).padStart(4, "0") +
                "x" +
                device.productId.toString(16).padStart(4, "0");
        }
        this.#filters = filters;
        this.#usbManager = usbManager;
    }