View Single Post
Old 08-02-2025, 02:43 AM   #382
Majutsushi
Zealot
Majutsushi knows the difference between 'who' and 'whom'Majutsushi knows the difference between 'who' and 'whom'Majutsushi knows the difference between 'who' and 'whom'Majutsushi knows the difference between 'who' and 'whom'Majutsushi knows the difference between 'who' and 'whom'Majutsushi knows the difference between 'who' and 'whom'Majutsushi knows the difference between 'who' and 'whom'Majutsushi knows the difference between 'who' and 'whom'Majutsushi knows the difference between 'who' and 'whom'Majutsushi knows the difference between 'who' and 'whom'Majutsushi knows the difference between 'who' and 'whom'
 
Posts: 109
Karma: 10128
Join Date: Aug 2023
Location: New Zealand
Device: Kobo Clara HD, Kobo Libra Colour
I've made a change to how the plugin identifies devices based on a suggestion by @chaley: devices are now identified by their serial number instead of by the Calibre-generated drive UUID. This way devices will still be recognized even after they have been reset.

However there's a bit of fallout from this where I'm not sure what the expected behaviour would be. When renaming a device in the plugin settings it will also update the device name stored in the same 'driveinfo.calibre' file (this is the reason why you can only rename currently connected devices). This means that the updated name will also get lost when resetting a device, and as a result the name in the plugin settings and the name in the file will be out of sync.

As far as I can tell the device name in that file is only used by the 'connected_device_name()' template function, and I'm not sure if users of that function expect it return whatever name they've given a device in the KU plugin dialog.

Keeping these names in sync even after a device reset would essentially require that the plugin checks the file on every connect and updates it if it finds a discrepancy, but that would potentially introduce a race condition if anything else in Calibre wants to update that file as well.

I couldn't find any discussion about why this behaviour of changing the on-device name was introduced in the first place, so maybe no one even knows it exists. Because of this and the above complications I'm tending towards not updating the on-device file and keeping the renaming purely to the KU settings (which would then also allow renaming non-connected devices), but I wanted to first get an understanding of whether people have been using this at all.
Majutsushi is offline   Reply With Quote