Skip to content

Falling back to WebUSB user-space drivers on MacOSΒ #204

Open

Description

@gniezen

On MacOS it is becoming more and more difficult to install kernel extensions, and their successor since Catalina, driver extensions. It can also be challenging to get a DriverKit entitlement in order to write a driver extension. Apple includes built-in kernel/driver extensions for a number of chipsets, but not all, and these also don't work if the device has a custom USB PID/VID.

Luckily, if there is no existing USB serial port driver installed, MacOS will load the default USB driver, which can be accessed over WebUSB. I have written a bunch of JS user-space drivers for FTDI, Texas Instruments, Silicon Labs and Prolific chipsets, and these work well as a fallback mechanism.

However, It does lead to a confusing user experience, where we first have to display the Web Serial permission prompt in case there is a USB driver already installed, and then display the WebUSB permission prompt when the user presses Cancel (as the Web Serial API doesn't find any devices) so that we can then connect using WebUSB instead.

Could there be away to make Web Serial a little bit more aware of WebUSB, for example by providing a new method that would automatically fall back to navigator.usb.requestDevice when navigator.serial.requestPort comes up empty?

Activity

  1. reillyeon commented on Jun 6, 2024

    @reillyeon
    Collaborator

    There's an issue on the WebUSB side tracking this: whatwg/usb#186

  2. gniezen commented on Jun 7, 2024

    @gniezen
    Author

    Ah, that's great, thanks @reillyeon ! I should probably have checked there first, but at least now we have issues on both repos tracking this. How can I help move this forward?

  3. reillyeon commented on Jun 7, 2024

    @reillyeon
    Collaborator

    The challenge is mainly on the implementation side. There's platform-specific work necessary to make sure we're modeling the device relationships correctly between the platform USB, serial and HID APIs. It's something that's on our team's roadmap but I can't make any promises on when we'll be able to deliver it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions