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

[Feature Request]: CH341 USB device scanning (auto-enumeration) #5829

Open
vidplace7 opened this issue Jan 12, 2025 · 4 comments
Open

[Feature Request]: CH341 USB device scanning (auto-enumeration) #5829

vidplace7 opened this issue Jan 12, 2025 · 4 comments
Labels
enhancement New feature or request linux-native related to running meshtastic as daemon on native linux

Comments

@vidplace7
Copy link
Member

vidplace7 commented Jan 12, 2025

Platform

Linux Native

Description

Currently meshtasticd requires manual config file changes after installation, which can be daunting to users who are not experienced with Linux.
With the coming release of CH341 USB dongles, we have the opportunity to provide a more simplified out of box experience.

meshtasticd should probe the usb bus for devices that match known VID and PID values, and select the appropriate pinmap if a known VID:PID value can be found.

This should become the default configuration of meshtasticd, while still allowing advanced users to change their configs for SPI Pi Hats / etc.

@vidplace7 vidplace7 added enhancement New feature or request linux-native related to running meshtastic as daemon on native linux labels Jan 12, 2025
@vidplace7
Copy link
Member Author

@psiegl would you consider taking a look at this? ❤️

@psiegl
Copy link
Contributor

psiegl commented Jan 12, 2025

Well, what can I say: You are truly right. It took me quite some afternoons to gdb myself through the code, figuring out what's going on. And I see your concern, meaning it is though to set up the right config. E.g. https://github.com/meshtastic/firmware/blob/master/src/platform/portduino/PortduinoGlue.cpp#L532 . Imagine you are missing the General: part in your homebrew config. Suddenly, meshtastic doesn't have the default general config flags, and well it doesn't survive and won't tell you :) . Just one of the issues, I stumbled into. My first thought was to propose a general config, that Meshtastic always comes with, while the user can 'overlay' his/her. However, you are right: Ideally meshtastic tries at least its best to scan for known configs and solely relies on the user interaction in case he/she enforces it. I will for sure propose changes to the PortduinoGlue.cpp. Maybe I have a good idea, how to bring in your idea.

@mverch67
Copy link
Collaborator

mverch67 commented Jan 13, 2025

Can't this be done automatically using udev rules (assuming with coming release you mean those with a unique serial number stored in eeprom) ? E.g. something like:

SUBSYSTEM=="usb", ACTION=="add" ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5512", DRIVERS=="ch341", PROGRAM="/usr/sbin/meshtastic-macgen %n" RUN+="/usr/sbin/meshtasticd -h %c -d ${HOME}/.portduino/%c -c /etc/meshtasticd/config-%n.yaml" MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1"

I.e. when you plugin a CH341 device a new meshtasticd process is automatically launched with the matching config.yaml file.

@fifieldt
Copy link
Contributor

I believe that's a good idea. The package could install a file in /etc/udev/rules.d/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request linux-native related to running meshtastic as daemon on native linux
Projects
None yet
Development

No branches or pull requests

4 participants