-
Notifications
You must be signed in to change notification settings - Fork 7
Add Serial Number to Avahi Service for Board Deduplication #48
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
Conversation
@lucarin91
lucarin91
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't figure out that we needed to add another sudoers file for this feature, which I would avoid to do it. So I think we should change the approach here, and we could instead do that in a systemd unit that is triggered only on the first boot, e.g., https://github.com/arduino/arduino-app-cli/blob/main/debian/arduino-app-cli/etc/systemd/system/arduino-burn-bootloader.service.
The Serial number of the board should not change, so we can do it just the first time you flash the board, and in there, you have all the permission to patch the Avahi service.
30a0cf2 to
2d88451
Compare
mirkoCrobu
commented
Nov 7, 2025
How to test it
- Create the .deb and push it into the board
On the board - Be sure that
/etc/avahi/services/arduino.servicedoesn't contain the serial number - Reboot the board
- Check
/etc/avahi/services/arduino.service: now you should see the serial number - Check that the .flag file exists:
ls -l /var/lib/arduino/avahi_serial_configured.flag - Check the service status (should be active (exited)):
systemctl status arduino-avahi-serial.service - Enable network mode:
arduino-app-cli system network-mode enable
From your PC - Check the board list configs(you should the network information with serial number:
):arduino-cli board list --json
debian/arduino-app-cli/etc/systemd/system/arduino-avahi-serial.service
Outdated
Show resolved
Hide resolved
@lucarin91
lucarin91
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also add the disable command in postrm as for the other services
@lucarin91
lucarin91
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I would improve a little bit the schell script
debian/arduino-app-cli/etc/systemd/system/arduino-avahi-serial.service
Outdated
Show resolved
Hide resolved
9723d4b to
ba934d4
Compare
@lucarin91
lucarin91
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mirkoCrobu I think you need to update rebase main, I see changes not related to this PR
mirkoCrobu
commented
Nov 10, 2025
@lucarin91 I had to change a commit author already includedd in main to pass license/cla.
Let me check if I can fix it
ba934d4 to
c1eb54f
Compare
@lucarin91
lucarin91
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is safe to always return errors
@dido18
dido18
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* set serial number for network discovery at post install time * adds space in a comment * set script running before Avahi service * code review fix * code review fix * code review fix
Motivation
A board connected via both USB and Network currently shows up as two separate devices in the board list. This makes it difficult for a client application to know it is the same physical board.
We need a way to "deduplicate" these entries by providing a common identifier, allowing the client to show just one entry for that board.
Change description
A simple approach is to add the board's serial number to its Avahi service file. This change will be made at runtime when the EnableNetworkMode function is executed.
Specifically, we will add a new containing the serial number (e.g., serial_number=YOUR_SERIAL) to the board's .service file.
Additional Notes
Reviewer checklist
main.