But after posting I realized that the enumeration in the second part of device string (0001 in the example above) will vary between 0001 and 0002 depending on which camera is first turned on while usb connected.
Yes, this is correct. USB device names are picked when the device is connected (on both linux and windows).
The only stably unique identifier for each camera, it seems, is the serial number string. But trying -s for both cameras results in errors on the second connect attempt.
Correct again. Getting the serial number currently requires making a connection to the camera, which destroys any existing connection. I think it may be possible to get this without, but haven't had time to really investigate yet.
It should also be able to detect when a device is already opened by another process, so you could have a connect option that only applies to unclaimed cameras. The error code rework I am doing now is a step toward being able to do this.
The best workaround I've found, when controlling chdkptp over command line from external scripts, is to make sure to power on camera A before camera B, then connect camera B using -s and finally connect camera A using -p. I guess I could also first do a list command and somehow save the results, parse which camera (serial) is currently linked to which device number and then use those device numbers to connect each camera through a specific process.
Both of these are reasonable options.
The other alternative is to do everything in one instance of chdkptp, but depending on your particular application, this may lead to other difficulties.