cyanfish / naps2

Scan documents to PDF and more, as simply as possible.
https://www.naps2.com
Other
2.74k stars 321 forks source link

Multiple scanners of the same device type get mixed up #426

Closed Asgatoril closed 1 month ago

Asgatoril commented 1 month ago

Describe the bug When using multiple scanners of the same model, they are shown in NAPS2 as "Devicename" , "Devicename #2", "Devicename #3" etc.., and can be given custom names and profiles in NAPS2.

If multiple scanners get disconnected and reconnected, e.g. because the devices go in standby, names shift, so that e.g. what was before "Devicename #2" ist now "Devicename #3" and vice versa. This causes the scanner profiles to use the wrong scanner.

To Reproduce Steps to reproduce the behavior: We used multiple Canon DR-C230, so I will use that devicename for this example. 1: Attach 2 or more scanners of the same type to the same computer running naps2 and write down in which order you connected them to the computer 2: Create a profile for each scanner. Call the first one "Scanner1" and the second one "Scanner2" 3: Attach the device "Canon DR-C230" to the profile "Scanner1" and the device "Canon DR-C230 #2" to the profile "Scanner2" 4: Scan something with the Profile "Scanner1". It should scan on the scanner that was connected first. 5: Turn off both scanners and turn them back on in the opposite order, they were connected before 6: Scan something with the Profile "Scanner1" again. It will now scan on the other scanner.

Expected behavior The scanners, selected in the profiles, should stay the same, no matter the order in which they are connected

Screenshots NAPS2

Desktop (please complete the following information):

Additional context The scanners also appear in the device manager with the same name, but each one gets its own registry entry with a different ContainerID (e.g. under: HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\USB\VID_1083&PID_1670\2&e8605e81&0&1). I added a registry key "FriendlyName" for both devices and hoped that this would also help NAPS2 to differentiate between them, but this sadly didn't work. The name in the device manager changes, but the name in NAPS2 stays the same.

cyanfish commented 1 month ago

This has to do with how scanners identify themselves to NAPS2, it can't be fixed within NAPS2 itself. You can try switching between WIA and TWAIN drivers to see if it makes a difference.

If you like you can also leave the device blank when creating a profile and it will prompt each time for which device to use.

Asgatoril commented 1 month ago

Ah, ok. Thank you for that information.

Is there anything uniquely identifying, like a serial number, that could be used to e.g. cache the last few connected devices or does WIA only expose the device name?

cyanfish commented 1 month ago

WIA uses a device ID instead of the name, but clearly based on your experience this ID isn't getting consistently mapped to the same device.