Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for fastboot mode #343

Open
chs72 opened this issue Sep 18, 2021 · 9 comments
Open

Support for fastboot mode #343

chs72 opened this issue Sep 18, 2021 · 9 comments
Labels
type:enhancement New feature or request
Milestone

Comments

@chs72
Copy link

chs72 commented Sep 18, 2021

如题

@yume-chan
Copy link
Owner

有可能,谷歌做过。

fastboot 和 adb 的设备标识符不一样,改一下就能搜索 fastboot 设备。

fastboot 和 adb 通信协议一样,但是支持的 service 不一样,需要重新写。

但是我不想搞坏我的手机,所以不会做 fastboot 支持。

@yume-chan
Copy link
Owner

Close as no further response

@xingrz
Copy link

xingrz commented Oct 9, 2021

@chs72 @yume-chan 我之前用另一个库的时候实现过。回头我来搞一下。

@yume-chan yume-chan reopened this Oct 12, 2021
@yume-chan yume-chan added the type:enhancement New feature or request label Dec 13, 2021
@yume-chan yume-chan changed the title 是否有可能基于此项目实现在线fastboot刷入分区? Support for fastboot mode Dec 23, 2021
@upintheairsheep
Copy link
Contributor

https://kdrag0n.github.io/fastboot.js/demo/
this is easy

@huxudong
Copy link

huxudong commented Jul 11, 2024

let deviceFilters = useMemo(() => [{ vendorId: 0x05c6, productId: 0x9008}], []);
const devices: AdbDaemonDevice[] = await AdbDaemonWebUsbDeviceManager.BROWSER!.getDevices(deviceFilters);

error: Type '{ vendorId: number; productId: number; }' is not assignable to type 'AdbDeviceFilter'


I see the current master code support, when will it be released?

getDevices(
      filters?: USBDeviceFilter[] | undefined,
): Promise<AdbDaemonWebUsbDevice[]>;

@yume-chan
Copy link
Owner

@huxudong Is your question related to fastboot mode? The new version just merges in the ADB filter for you. If you want to select fastboot mode devices you still need to specify classCode, subclassCode and protocolCode yourself otherwise the library won't know how to talk to the device: https://docs.tangoapp.dev/tango/daemon/usb/device-filter/#filters-in-tango


We don't have a release schedule, but before publishing a new version I need some time to test out all the changes.

@huxudong
Copy link

huxudong commented Jul 11, 2024

const ADB_PROTOCOL =      { classCode: 0xff, subclassCode: 0x42, protocolCode: 1 }
const FASTBOOT_PROTOCOL = { classCode: 0xff, subclassCode: 0x42, protocolCode: 3 }
const EDL_PROTOCOL = {...ADB_DEFAULT_DEVICE_FILTER, vendorId: 0x05c6, productId: 0x9008}
let deviceFilters = useMemo(() => [ADB_PROTOCOL, FASTBOOT_PROTOCOL, EDL_PROTOCOL], []);
const devices: AdbDaemonDevice[] = await AdbDaemonWebUsbDeviceManager.BROWSER!.getDevices(deviceFilters);

adb, fastboot mode can find device.
I don't know if the code is correct, but the EDL mode can't find the device

I don't think EDL mode requiresclassCode, subclassCode and protocolCode

@yume-chan
Copy link
Owner

I don't think EDL mode requiresclassCode, subclassCode and protocolCode

AdbDaemonWebUsbDeviceManager#getDevices gives you ADB devices (or fastboot devices, at least they use the ADB protocol). If EDL mode doesn't use ADB protocol, then creating an AdbDaemonDevice on it makes no sense.

You can use navigator.usb.getDevices() to get all paired devices, it doesn't support filters, so you need to select them yourself.

@huxudong
Copy link

Very much appreciate your serious reply! I think we should develop another set of WebUsbDeviceManage, not just support ADB protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants