Logo Search packages:      
Sourcecode: hal version File versions

void hal_device_print ( LibHalContext ctx,
const char *  udi 
)

Print a device to stdout; useful for debugging.

Parameters:
ctx The context for the connection to hald
udi Unique Device Id

Definition at line 2034 of file libhal.c.

References hal_device_get_all_properties(), hal_free_property_set(), hal_psi_get_bool(), hal_psi_get_double(), hal_psi_get_int(), hal_psi_get_key(), hal_psi_get_string(), hal_psi_get_type(), hal_psi_get_uint64(), hal_psi_has_more(), hal_psi_init(), and hal_psi_next().

Referenced by rename_and_merge().

{
      int type;
      char *key;
      LibHalPropertySet *pset;
      LibHalPropertySetIterator i;

      printf ("device_id = %s\n", udi);

      pset = hal_device_get_all_properties (ctx, udi);

      for (hal_psi_init (&i, pset); hal_psi_has_more (&i);
           hal_psi_next (&i)) {
            type = hal_psi_get_type (&i);
            key = hal_psi_get_key (&i);
            switch (type) {
            case DBUS_TYPE_STRING:
                  printf ("    %s = %s (string)\n", key,
                        hal_psi_get_string (&i));
                  break;
            case DBUS_TYPE_INT32:
                  printf ("    %s = %d = 0x%x (int)\n", key,
                        hal_psi_get_int (&i),
                        hal_psi_get_int (&i));
                  break;
            case DBUS_TYPE_UINT64:
                  printf ("    %s = %lld = 0x%llx (uint64)\n", key,
                        hal_psi_get_uint64 (&i),
                        hal_psi_get_uint64 (&i));
                  break;
            case DBUS_TYPE_BOOLEAN:
                  printf ("    %s = %s (bool)\n", key,
                        (hal_psi_get_bool (&i) ? "true" :
                         "false"));
                  break;
            case DBUS_TYPE_DOUBLE:
                  printf ("    %s = %g (double)\n", key,
                        hal_psi_get_double (&i));
                  break;
            default:
                  printf ("    *** unknown type for key %s\n", key);
                  break;
            }
      }
      hal_free_property_set (pset);
}


Generated by  Doxygen 1.6.0   Back to index