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: 358 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, which is not supported natively by WSL as of this writing (updated 2024-12-13).

Pre-requisites
As the title suggests, this guide is intended for developers using WSL 2. This is because usbipd-win and WSLg do not support WSL 1 distros. It is also not applicable to Windows on ARM computers as the author of usbipd-win has no plans to support ARM64. Although there is a non-production solution for ARM64 PCs, this article only covers usbipd-win for now as the writer does not have any ARM64 device for verifying.

For Windows 10 users, you must be running version 21H2 or higher, which is the minimum requirement for WSLg to work.

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.

The latest release of WSL 2 (v2.3.26) does not come with USB mass storage modules. Only pre-releases v2.3.11-2.3.14 provide them for now.

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. The guide will be using Ubuntu 24.04 LTS for demonstration.

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
On the Windows host, go to the release page for the usbipd-win project and download the latest .msi installer.

After installing usbipd-win, connect your calculator with USB. Then open PowerShell as administrator and run usbipd list. The list should include one of the following information:

07cf:6101  CESG502
07cf:6102  Casio MassStorage Device
07cf:6103  USB Mass Storage Device

Copy its bus ID and execute the following commands while the WSL instance is running:

usbipd bind -b <calculator-busid>
usbipd attach -w -b <calculator-busid>

Note that for calculators that support USB Flash mode, you have to repeat the bind command for each connection mode as they have different PID as shown above.

To let your calculator always connect to WSL instance instead of the host, add -a flag after usbipd attach. This will start endless attach loop for the calculator connection.

For calculators that use CESG502, type p7 info in WSL terminal to confirm that Cahute can detect the calculator connection. 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 use root account and install fxSDK there instead.

4. If p7screen prompts you:

Segmentation fault (core dumped)

You probably encounter 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: 1966 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 blogMes autres projets

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 - 2024 | Il y a 55 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