changeset: 17:b05eb5f85ad9
tag: tip
user: Dimitrios Papastamos <stateless [at] archlinux.us>
date: Tue May 19 19:03:05 2009 -0700
files: skvm.c
description:
Do not add a device to the managed device list if it is locked.
diff -r 41fb2d7a1765 -r b05eb5f85ad9 skvm.c
--- a/skvm.c Sat May 16 00:55:01 2009 -0700
+++ b/skvm.c Tue May 19 19:03:05 2009 -0700
@@ -257,8 +257,11 @@
deinit(void) {
struct device_t *iter, *tmp;
- libhal_ctx_shutdown(hal_ctx, (DBusError *)NULL);
- libhal_ctx_free(hal_ctx);
+ if (hal_ctx) {
+ libhal_ctx_shutdown(hal_ctx, (DBusError *)NULL);
+ libhal_ctx_free(hal_ctx);
+ }
+
dbus_connection_unref(dbus_conn);
iter = head;
@@ -279,10 +282,26 @@
static void
device_added(LibHalContext *context, const char *did) {
const char *dudi, *fstype;
- char *dev, *mountp, *mountable, *label;
+ char *dev, *mountp, *mountable, *label, *locked_reason;
LibHalVolume *volume;
LibHalDrive *drive;
struct device_t *device;
+
+ if (libhal_device_property_exists(context, did, "info.locked",
+ (DBusError *)NULL)
+ && libhal_device_get_property_bool(context, did, "info.locked",
+ (DBusError *)NULL)) {
+ if (debug_mode_flag) {
+ locked_reason = libhal_device_get_property_string(
+ context, did, "info.locked.reason",
+ (DBusError *)NULL);
+ if (locked_reason) {
+ printf("%s%d: %s\n", __FILE__, __LINE__, locked_reason);
+ libhal_free_string(locked_reason);
+ }
+ }
+ return;
+ }
if (!libhal_device_query_capability(context, did, "volume",
(DBusError *)NULL))
Received on Tue May 19 2009 - 18:03:51 UTC
This archive was generated by hypermail 2.2.0 : Tue May 19 2009 - 18:12:04 UTC