Les membres ayant 30 points peuvent parler sur les canaux annonces, projets et hs du chat.
La shoutbox n'est pas chargée par défaut pour des raisons de performances. Cliquez pour charger.

Forum Casio - Vos tutoriels et astuces


Index du Forum » Vos tutoriels et astuces » Guide for using Cahute and fxlink on WSL 2
Calcloverhk Hors ligne Membre Points: 398 Défis: 10 Message

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 (updated 2025-6-15).

Requirements
  • Latest update of Windows 10/11
  • WSL 2.5.7+ (minimum stable version that comes with Linux kernel 6.6)
  • usbipd-win 4.0.0+ (5.0.0+ for Windows on ARM64 devices)

  • The guide will be using WSL 2.5.7, usbipd-win 5.1.0 and Ubuntu WSL 24.04 LTS for demonstration.

    Setting up WSL 2
    If you are new to WSL, 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 /norestart

    Restart your PC to apply these changes, then install the latest stable build of WSL by clicking this link.

    Set the default install version for new distros to WSL 2:

    wsl --set-default-version 2

    You can type wsl --list --online and select your preferred distro from the list by wsl --install <distro> --web-download, or install other third-party WSL distros like ArchWSL.

    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. 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
    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. If usbipd-win cannot automatically load vhci_hcd module, edit the module config file:

    % sudo nano /etc/modules-load.d/modules.conf

    Add vhci_hcd module at a new line, save the config file and restart your WSL session.

    3. 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.

    4. If p7screen prompts you:

    Segmentation fault (core dumped)

    You probably have encountered the bug that has been upstreamed to libsdl's bug tracker (thanks Cakeisalie5 for the report). For now to work around it, create a WSLg config file:

    % sudo nano /etc/tmpfiles.d/wslg.conf

    Save the config file with the following content and restart your WSL session:

    # Type Path           Mode UID  GID  Age Argument
    L+     /tmp/.X11-unix -    -    -    -   /mnt/wslg/.X11-unix



    Cakeisalie5 Hors ligne Ancien administrateur Points: 1979 Défis: 11 Message

    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:

    CalcLoverHK a écrit :
    4. If p7screen prompts you:

    Segmentation fault (core dumped)

    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:

    • Cahute being built with debug syms, installed using giteapc install cake/cahute:contributor;
    • p7screen being run with valgrind or equivalent, to provide a stack trace of the segmentation fault.

    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.
    Respirateur d'air, BDFL de Cahute, des utilitaires de communication pour calculatrices CASIO.


    Mon blog
    Calcloverhk Hors ligne Membre Points: 398 Défis: 10 Message

    Citer : Posté le 05/03/2025 19:42 | #


    Updated the usbipd-win section with the usage of policy subcommand, which is faster than manually binding every single USB protocol of your calculators
    C.Basic Wiki Project progress as of 2024/2/12
       30%



    LienAjouter une imageAjouter une vidéoAjouter un lien vers un profilAjouter du codeCiterAjouter un spoiler(texte affichable/masquable par un clic)Ajouter une barre de progressionItaliqueGrasSoulignéAfficher du texte barréCentréJustifiéPlus petitPlus grandPlus de smileys !
    Cliquez pour épingler Cliquez pour détacher Cliquez pour fermer
    Alignement de l'image: Redimensionnement de l'image (en pixel):
    Afficher la liste des membres
    :bow: :cool: :good: :love: ^^
    :omg: :fusil: :aie: :argh: :mdr:
    :boulet2: :thx: :champ: :whistle: :bounce:
    valider
     :)  ;)  :D  :p
     :lol:  8)  :(  :@
     0_0  :oops:  :grr:  :E
     :O  :sry:  :mmm:  :waza:
     :'(  :here:  ^^  >:)

    Σ π θ ± α β γ δ Δ σ λ
    Veuillez donner la réponse en chiffre
    Vous devez activer le Javascript dans votre navigateur pour pouvoir valider ce formulaire.

    Si vous n'avez pas volontairement désactivé cette fonctionnalité de votre navigateur, il s'agit probablement d'un bug : contactez l'équipe de Planète Casio.

    Planète Casio v4.3 © créé par Neuronix et Muelsaco 2004 - 2025 | Il y a 76 connectés | Nous contacter | Qui sommes-nous ? | Licences et remerciements

    Planète Casio est un site communautaire non affilié à Casio. Toute reproduction de Planète Casio, même partielle, est interdite.
    Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou copyrights.
    CASIO est une marque déposée par CASIO Computer Co., Ltd