Skip to content

[RFC] DefaultDevice: Add Generic Nickname support#2343

Merged
knro merged 3 commits intoindilib:masterfrom
perfinion:indi-nicknames
Mar 12, 2026
Merged

[RFC] DefaultDevice: Add Generic Nickname support#2343
knro merged 3 commits intoindilib:masterfrom
perfinion:indi-nicknames

Conversation

@perfinion
Copy link
Contributor

This extends the DefaultDevice class to support nicknames.

Nicknames are stored in ~/.indi/INDINicknames.xml in a format like the below. Nicknames are assoicated with a driver and stable device identifier.

The device identifier must be stable across boots and not dependent on which port the device is plugged into. Usually this will be some form of serial number of the device, but specifics are left up to each driver.

Since each identifier is per-driver, devices from different drivers can share the same nickname. The INDI framework must not try to interpret the identifier, only compare for equality since different devices might have serial numbers in different formats.

Since the device-name can't be changed once the driver is running, changes to nicknames can only take effect at the next INDI startup.

The NicknameTP should be added with addNicknameControl().

<INDINicknames>
 <nickname driver="AcmeFocuser" identifier="SN123">MainScope</nickname>
 <nickname driver="AcmeFocuser" identifier="SN456">GuideScope</nickname>
 <nickname driver="AcmeDustCap" identifier="CAP-1-2-3">MainScope</nickname>
</INDINicknames>

@perfinion
Copy link
Contributor Author

@knro @tbowers7 Here is a Request For Comments for indilib/indi-3rdparty#1226
Can you take a look and let me know if there are any major structural changes that need doing?

It builds and I've tested the XML parsing in a separate test program, but I have not finished integrating it into asi_focusers.cpp yet. I tried to add a addNicknameControl() similar to other properties in DefaultDevice, but I'm not sure how to best handle updates. The problem is I dont want to add a SerialNumberTP because it can be any stable ID, does not have to necessarily be a serial number specifically, so that is best left up to the driver, not in DefaultDevice.

Also regarding the XML, I wonder if it is better to have <driver><nickname> to be more similar to ParkData.xml (I only realized that might be better after I'd finished writing it this way, so figured i'd let you have a look first.

@knro
Copy link
Contributor

knro commented Mar 2, 2026

Great! Yes, if it is similar to ParkData.xml, it's best. I also think this feature should be disabled by default until enabled by the child driver via addNicknameControl or similar. Please let me know once you are able to test if full with the ASI driver as well so we know it works for 3rd party drivers.

@knro
Copy link
Contributor

knro commented Mar 7, 2026

@perfinion Were you able to update this and test it thoroughly with ZWO drivers?

@perfinion
Copy link
Contributor Author

Hey, no not completely yet. I had a work trip this week. I'm hoping to finish it up this weekend tho

@knro
Copy link
Contributor

knro commented Mar 10, 2026

@perfinion How is it going?

This extends the DefaultDevice class to support nicknames.

Nicknames are stored in ~/.indi/INDINicknames.xml in a format like the below.
Nicknames are assoicated with a driver and stable device identifier.

The device identifier must be stable across boots and not dependent on which
port the device is plugged into. Usually this will be some form of serial
number of the device, but specifics are left up to each driver.

Since each identifier is per-driver, devices from different drivers can
share the same nickname. The INDI framework must not try to interpret the
identifier, only compare for equality since different devices might have
serial numbers in different formats.

Since the device-name can't be changed once the driver is running, changes
to nicknames can only take effect at the next INDI startup.

The NicknameTP should be added with addNicknameControl().

<INDINicknames>
 <nickname driver="AcmeFocuser" identifier="SN123">MainScope</nickname>
 <nickname driver="AcmeFocuser" identifier="SN456">GuideScope</nickname>
 <nickname driver="AcmeDustCap" identifier="CAP-1-2-3">MainScope</nickname>
</INDINicknames>

Signed-off-by: Jason Zaman <jason@perfinion.com>
Nesting the <nickname> inside the <device> makes the saving code much
simpler too.
@perfinion
Copy link
Contributor Author

@knro I implemented it for ZWO asi_ccd and the focuser, that lead me to find a few things lacking in the base class. I added a virtual function so that the driver can see nickname updates and then save the result. I finally had a few clear nights after months of clouds so I have not deployed the latest version on my stellarmate yet, I will test it tomorrow and let you know how things go. Please let me know if you find any issues in the structure you'd like me to change too. :)

@knro knro merged commit 84805c5 into indilib:master Mar 12, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants