Re: File not found in search paths
Thomas Viehmann <[email protected]>
| Newsgroups | gmane.comp.lib.libchipcard.devel |
|---|---|
| Message-ID | <[email protected]> |
Martin Preuss wrote: > Hmm, ttyUSB wird bei Dir gar nicht gescanned: Du koenntest vielleicht mal in > den entsprechenden Code > schauen: "src/lib/chipcard2-server/common/usbttyscanner.c": Da musste ich ja > auf Libsysfs 2.x umstellen, und eventuell funktioniert das nicht mehr so, wie > vorher... Ja, sorry, ich sollte wirklich häufiger testen. Hast Du Lust auf ein neues Release oder soll ich - ha, das erwartete jetzt niemand mehr - die Debian-Pakete gelegentlich so mal updaten? Viele Grüße T.
usbttyscanner.libsysfs2.diff
(text/x-patch, 1.3 KB)
--- libchipcard2-2.1.3.orig/src/lib/chipcard2-server/common/usbttyscanner.c
+++ libchipcard2-2.1.3/src/lib/chipcard2-server/common/usbttyscanner.c
@@ -95,6 +95,7 @@
struct sysfs_attribute *cur = NULL;
struct dlist *devlist = NULL;
struct dlist *attributes = NULL;
+ struct dlist *children = NULL;
int port=0, vendorId=0, productId=0;
LC_DEVICE *currentDevice;
@@ -111,10 +112,16 @@
/* for each device: look for ttyUSB in children*/
port = -1;
#ifdef HAVE_SYSFS2
- temp_device=sysfs_open_device_path(curdev->path);
+ children = sysfs_open_directory_list(curdev->path);
+ if (children) {
+ dlist_for_each_data(children, child,
+ struct sysfs_device) {
+ if (strncmp(child->name, "ttyUSB", 6) == 0)
+ port = atoi(&child->name[6]);
+ }
+ }
#else
temp_device = sysfs_open_device_tree(curdev->path);
-#endif
if (temp_device) {
if (temp_device->children) {
dlist_for_each_data(temp_device->children, child,
@@ -123,8 +130,9 @@
port = atoi(&child->name[6]);
}
}
- sysfs_close_device_tree(temp_device);
}
+ sysfs_close_device_tree(temp_device);
+#endif
/* found something, well maybe */
if (port != -1) {
parent = sysfs_get_device_parent(curdev);