Discussion:
Enumeration devices gets SEGV on Ubuntu 16.10
Add Reply
Wilhelm Meier
2017-04-04 08:23:23 UTC
Reply
Permalink
Raw Message
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
--
sane-devel mailing list: sane-***@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
to sane-devel-***@lists.alioth.debian.org
Loading...