[sane-devel] Enumeration devices gets SEGV on Ubuntu 16.10
Wilhelm Meier
wilhelm.meier at hs-kl.de
Tue Apr 4 08:23:23 UTC 2017
Hi all,
there are problems scanning for new usb-devices on Ubuntu-16.10. This
problem hits most (all) users of scanbd if they remove/insert usb devices.
It can be be broken down to the following example, which crashes with
SEGV if one inserts/removes use-devices:
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <sane/sane.h>
int main () {
while (true) {
SANE_Int sane_version = 0;
if (sane_init(&sane_version, 0) != SANE_STATUS_GOOD) {
printf("Can't init sane\n");
exit(EXIT_FAILURE);
}
printf("sane version %d.%d\n", SANE_VERSION_MAJOR(sane_version),
SANE_VERSION_MINOR(sane_version));
const SANE_Device** device_list = NULL;
if (sane_get_devices(&device_list, SANE_TRUE) == SANE_STATUS_GOOD) {
const SANE_Device** dev = device_list;
while (*dev) {
printf("dev name: %s\n", (*dev)->name);
dev++;
}
} else {
printf("Can't get dev list\n");
exit(EXIT_FAILURE);
}
sleep (1);
printf("sane_exit\n");
sane_exit();
sleep (1);
}
exit(EXIT_SUCCESS);
}
Are there any hints or workarounds?
BTW: on ArchLinux and Gentoo there are no problems ...
--
Wilhelm
More information about the sane-devel
mailing list