diff options
author | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-11-28 01:45:54 -0200 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-11-28 01:45:54 -0200 |
commit | 36675d65ddc1ed35190f5fdbb18d5b460c7ba972 (patch) | |
tree | 74232c8c20b8292530b8fb350c9c14a7ab76b6d6 /src | |
parent | 791cbbf9df621d9712731990271bf3b53076673a (diff) |
Dont dlopen libsysfs.so, instead, link with it when available.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 5 | ||||
-rw-r--r-- | src/acecad.c | 87 |
2 files changed, 46 insertions, 46 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 5ff68eb..65b449b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,6 +26,11 @@ # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. @DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la @DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version + +if HAVE_LIBSYSFS +@DRIVER_NAME@_drv_la_LIBADD = -lsysfs +endif + @DRIVER_NAME@_drv_ladir = @inputdir@ @DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c @DRIVER_NAME@.h diff --git a/src/acecad.c b/src/acecad.c index f3c284a..63c5aaf 100644 --- a/src/acecad.c +++ b/src/acecad.c @@ -245,53 +245,48 @@ AceCadAutoDevProbe(LocalDevicePtr local, int verb) char *link = NULL; struct dlist *devs = NULL; struct dlist *links = NULL; - void *libsysfs = NULL; - - if ((libsysfs = dlopen("libsysfs.so", RTLD_NOW | RTLD_GLOBAL))) { - xf86MsgVerb(X_INFO, verb, "%s: querying sysfs for Acecad tablets\n", local->name); - usb_bus = sysfs_open_bus(usb_bus_name); - if (usb_bus) { - xf86MsgVerb(X_PROBED, 4, "%s: usb bus opened\n", local->name); - acecad_driver = sysfs_get_bus_driver(usb_bus, acecad_driver_name); - if (acecad_driver) { - xf86MsgVerb(X_PROBED, 4, "%s: usb_acecad driver opened\n", local->name); - devs = sysfs_get_driver_devices(acecad_driver); - if (devs) { - xf86MsgVerb(X_PROBED, 4, "%s: usb_acecad devices retrieved\n", local->name); - dlist_for_each_data(devs, candidate, struct sysfs_device) { - xf86MsgVerb(X_PROBED, 4, "%s: device %s at %s\n", local->name, candidate->name, candidate->path); - links = sysfs_open_link_list(candidate->path); - dlist_for_each_data(links, link, char) { - if (sscanf(link, "input:event%d", &i) == 1) { - xf86MsgVerb(X_PROBED, 4, "%s: device %s at %s: %s\n", local->name, candidate->name, candidate->path, link); - break; - } - } - sysfs_close_list(links); - if (i > 0) /* We found something */ - break; - } - } else - xf86MsgVerb(X_WARNING, 4, "%s: no usb_acecad devices found\n", local->name); - } else - xf86MsgVerb(X_WARNING, 4, "%s: usb_acecad driver not found\n", local->name); - } else - xf86MsgVerb(X_WARNING, 4, "%s: usb bus not found\n", local->name); - sysfs_close_bus(usb_bus); - dlclose(libsysfs); - - if (i > 0) { - /* We found something */ - np = SET_EVENT_NUM(fname, i); - if (np < 0 || np >= EV_DEV_NAME_MAXLEN) { - xf86MsgVerb(X_WARNING, verb, "%s: unable to manage event device %d\n", local->name, i); - } else { - goto ProbeFound; - } - } else - xf86MsgVerb(X_WARNING, verb, "%s: no Acecad devices found via sysfs\n", local->name); + + xf86MsgVerb(X_INFO, verb, "%s: querying sysfs for Acecad tablets\n", local->name); + usb_bus = sysfs_open_bus(usb_bus_name); + if (usb_bus) { + xf86MsgVerb(X_PROBED, 4, "%s: usb bus opened\n", local->name); + acecad_driver = sysfs_get_bus_driver(usb_bus, acecad_driver_name); + if (acecad_driver) { + xf86MsgVerb(X_PROBED, 4, "%s: usb_acecad driver opened\n", local->name); + devs = sysfs_get_driver_devices(acecad_driver); + if (devs) { + xf86MsgVerb(X_PROBED, 4, "%s: usb_acecad devices retrieved\n", local->name); + dlist_for_each_data(devs, candidate, struct sysfs_device) { + xf86MsgVerb(X_PROBED, 4, "%s: device %s at %s\n", local->name, candidate->name, candidate->path); + links = sysfs_open_link_list(candidate->path); + dlist_for_each_data(links, link, char) { + if (sscanf(link, "input:event%d", &i) == 1) { + xf86MsgVerb(X_PROBED, 4, "%s: device %s at %s: %s\n", local->name, candidate->name, candidate->path, link); + break; + } + } + sysfs_close_list(links); + if (i > 0) /* We found something */ + break; + } + } else + xf86MsgVerb(X_WARNING, 4, "%s: no usb_acecad devices found\n", local->name); + } else + xf86MsgVerb(X_WARNING, 4, "%s: usb_acecad driver not found\n", local->name); + } else + xf86MsgVerb(X_WARNING, 4, "%s: usb bus not found\n", local->name); + sysfs_close_bus(usb_bus); + + if (i > 0) { + /* We found something */ + np = SET_EVENT_NUM(fname, i); + if (np < 0 || np >= EV_DEV_NAME_MAXLEN) { + xf86MsgVerb(X_WARNING, verb, "%s: unable to manage event device %d\n", local->name, i); + } else { + goto ProbeFound; + } } else - xf86MsgVerb(X_WARNING, 4, "%s: libsysfs not found\n", local->name); + xf86MsgVerb(X_WARNING, verb, "%s: no Acecad devices found via sysfs\n", local->name); #endif |