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

FTDI D2XX - FT_Open not working on WSL2 #10151

Closed
1 of 2 tasks
ThierryCam opened this issue May 30, 2023 · 3 comments
Closed
1 of 2 tasks

FTDI D2XX - FT_Open not working on WSL2 #10151

ThierryCam opened this issue May 30, 2023 · 3 comments

Comments

@ThierryCam
Copy link

ThierryCam commented May 30, 2023

Windows Version

Microsoft Windows [Version 10.0.19045.2965]

WSL Version

1.2.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.90.1

Distro Version

Ubuntu 20.04

Other Software

FTDI D2XX - Linux X64 - library version 1.4.27 (https://ftdichip.com/drivers/d2xx-drivers/)
USBIPD - 3.0.0+361.Branch.master.Sha.89d4b327c99a4eecc9b583e1843a428aae3c9270

Repro Steps

Not sure if it's a bug or a missing feature.

  • I try to use FTDI library within WSL2.
  • I use usbipd wsl attach to attach my USB device (ID 0403:6010) to WSL2 Distro
  • I can see /dev/ttyUSB0 & /dev/ttyUSB1 ($ ls /dev/ttyUSB*)
    the

Expected Behavior

On calling the FTDI library API, I expected the FT_Open() method to succeed (return 0)
See https://ftdichip.com/wp-content/uploads/2020/08/D2XX_Programmers_GuideFT_000071.pdf

My goal is to be able to use the FTDI driver within WSL2, if it's possible.

Actual Behavior

Calling FT_Open return FT_DEVICE_NOT_OPENED

Diagnostic Logs

  • Following FTDI installation guide (https://ftdichip.com/wp-content/uploads/2020/08/AN_220_FTDI_Drivers_Installation_Guide_for_Linux-1.pdf)
  • In Linux, the VCP driver and D2XX driver are incompatible with each other. When a FTDI device is plugged in, the VCP driver must be unloaded before a D2XX application can be run. Use the remove module (rmmod) command to do this:
    $ sudo rmmod ftdi_sio
    But this command doesn't work.
  • I also tried to add this udev rules, which didn't work either:
    ACTION=="add",ATTRS{idVendor}=="0403",ATTRS{idProduct}=="6010",MODE="0666",RUN+="/sbin/rmmod ftdi_sio",OPTIONS="last_rule"
@elsaco
Copy link

elsaco commented May 30, 2023

@ThierryCam the USB FTDI serial driver is built into the kernel, see details at:

https://github.com/microsoft/WSL2-Linux-Kernel/blob/4aeb7776ebf6d022dfe49fc8abf4ece02d523e84/Microsoft/config-wsl#L2761

Build a custom kernel with ftdi_sio as a module.

@ThierryCam
Copy link
Author

The issue I have (I guess), is not about ftdi_sio, which giving correctly a Virtual Com Port (VCP) on my setup.
What I cannot do is to disable this udev service for a specific device, to use D2XX API instead.
I tried to add this udev rules, but it seems not to be possible to do it on WSL:
ACTION=="add",ATTRS{idVendor}=="0403",ATTRS{idProduct}=="6010",MODE="0666",RUN+="/sbin/rmmod ftdi_sio",OPTIONS="last_rule"
FT_Open (FTDI API) is still returning FT_DEVICE_NOT_OPENED, and not sure there's a way to make it work on WSL.

@OneBlue
Copy link
Collaborator

OneBlue commented Jun 6, 2023

Thanks for reporting this @ThierryCam. WSL doesn't directly manage USB devices so this issue should be opened on usbpid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants