Re-plug USB scanner and can not scan when frontends runs
I'm developing a program that call sane libs do the scan.
call the API like
sane_init()
sane_get_devices()
sane_open()
sane_start()
sane_cancel()
sane_close()
it runs correctly and I can get the right image data
but when I re-plugged the usb and not close the program, do the scan again, the sequence of call API also like above
then when runs to sane_open(), the debug message shows invalid argument. The Scanner name is still the old one eg. libusb:001:003 but sane-find-scanner shows the scanner is libusb:001:004
When I run my program again, I can get the right scanner name like: libusb:001:004, and I can do the scan correctly
How can I get the correct scanner name when I re-plug the usb of the scanner with my program running.
THX.
Edited by Olaf Meeuwissen