Guide for using Cahute and fxlink on WSL 2
Posté le 15/09/2024 20:32
This tutorial guides you to enable USB communication in WSL 2 for Cahute and fxlink.
Demonstration setup
Windows 10/11 with latest updatesWSL 2.5.9Ubuntu 24.04 LTS (WSL distro)usbipd-win 5.1.0
Setting up WSL 2
If you are new to WSL 2, open PowerShell as administrator and execute the following commands to enable it:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all
Restart your PC, then install the latest release of WSL by
wsl --update --web-download.
You can enter
wsl --list --online and select your preferred distro from the list by
wsl --install <distro>, or install other third-party WSL distros.
Installing Cahute and fxlink
Make sure to
sudo apt update && sudo apt upgrade to have the latest libraries before going through all these instructions.
Go to
the README of GiteaPC and install it. Since we will be using the full version of fxlink, install the following dependencies:
% sudo apt-get install cmake python3-pil libusb-1.0-0-dev libudev-dev libsdl2-dev libpng-dev libncurses-dev libudisks2-dev libglib2.0-dev
Then continue with the remaining instructions as usual.
Lastly, follow
these instructions to install Cahute.
Instructions for using usbipd-win
The following instructions are for CLI users. If you prefer GUI, you can take a look at
Alelec's or
Nickbeth's WSL USB manager.
On the Windows host, go to the
release page for the usbipd-win project and download the latest .msi installer.
After installing usbipd-win, open Windows Terminal with elevated privileges. Execute the following commands to add all Casio calculator protocols to the policy:
usbipd policy add -e Allow -o 'AutoBind' -i 07cf:6101
usbipd policy add -e Allow -o 'AutoBind' -i 07cf:6102
usbipd policy add -e Allow -o 'AutoBind' -i 07cf:6103
Connect your calculator to PC and run
usbipd list. Look for the USB device with a VID of
07cf and record its bus ID. If you set up the policy correctly, it should indicate "Allowed" in STATE column.
While your WSL instance is active, attach your calculator by
usbipd attach -w -b <bus-id>.
To let your calculator always connect to WSL instance instead of the host, add
-a flag after
usbipd attach. This will start an endless attach loop until you press Ctrl+C to terminate it.
The
-u flag allows you to start the attach loop, even if your calculator is not connected to that port. Note that it requires
-a and
-b flags to be present in your command input.
For calculators that use CESG502, type
p7 info in WSL terminal to confirm that Cahute can detect the calculator connection and list the calculator info. If your calculator is in USB Flash mode, enter
lsblk to see if its storage appears under
sdx directory.
Possible issues and workarounds
(Update 2025-6-25: removed vhci_hcd and SDL segfault/error workarounds as they were fixed by the latest update of usbipd-win, WSL and sdl2-compat)
1. If you have installed
USBPcap in Windows (which is used for debugging with Cahute),
usbipd will prompt you:
usbipd: warning: USB filter 'USBPcap' is known to be incompatible with this software; 'bind --force' will be required.
If you prefer not to force bind your calculator to WSL instance, do not use both components simultaneously.
2. Since fxlink is installed in your home directory,
fxsdk build-cg -s may not work properly as it requires sudo privileges. In this case, execute the following workaround in WSL terminal:
% which fxlink
Copy its path and enter the following command at your fxSDK project directory as sudo:
% sudo /full/path/to/fxlink -sw <your-addin>.g3a
Another way (but not recommended) is to start as root and install fxSDK there instead.
Citer : Posté le 05/10/2024 16:24 | #
Hey, thanks for this tutorial! I've added issue #48 on Cahute to integrate this directly in Cahute's documentation, in addition to the udev rule warning your original topic helped me identify and add to the GiteaPC install section
As described in #projets, I'm kind of worried about this section of the instructions though:
4. If p7screen prompts you:
Segmentation faults are never an expected behaviour, and it feels like something I should either fix in p7screen, or make an upstream report about in libsdl's bug tracker, depending on which is at fault here.
In order to do this, I would be glad if you could reproduce the issue with the following parameters:
For reference, you've quoted this to be the source of the issue, and this for being the source of the solution you've provided here, and the issue only occurs on ArchWSL, and not Ubuntu WSL.
Mon blog
Citer : Posté le 05/03/2025 19:42 | #
Updated the usbipd-win section with policy subcommand, which is faster than manually binding every single USB protocol of your calculators