diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml index 481665a..d3216ad 100644 --- a/doc/spec/hal-spec-properties.xml +++ b/doc/spec/hal-spec-properties.xml @@ -4011,7 +4011,8 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'} capability net and they will export the properties below. This namespace only describe the generic aspect of networking devices; specific networking technologies - such as IEEE 802.3 and IEEE 802.11 have separate namespaces. + such as IEEE 802.3, IEEE 802.11 and Bluetooth have separate + namespaces. @@ -4192,6 +4193,65 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'} + + + net.bluetooth namespace + + + Bluetooth ethernet networking devices is described in this namespace + for device objects with the capability + net.bluetooth. + Note that device + objects can only have the net.bluetooth capability + if they already have the capability net. + + + + + + Key (type) + Values + Mandatory + Description + + + + + + net.bluetooth.mac_address (uint64) + + example: 0x0010605d8ef4 + + Only if the net.bluetooth capability is set + + 48-bit address + + + + net.bluetooth.name (string) + + example: Network Access Point Service + + Only if the net.bluetooth capability is set + + Displayable Name + + + + net.bluetooth.uuid (string) + + example: 00001116-0000-1000-8000-00805f9b34fb + + Only if the net.bluetooth capability is set + + Universal Unique IDentifier + + + + + + + net.irda namespace diff --git a/hald/linux/device.c b/hald/linux/device.c index da1785a..461daee 100644 --- a/hald/linux/device.c +++ b/hald/linux/device.c @@ -435,48 +459,49 @@ net_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de media_type = hal_device_property_get_int (d, "net.arp_proto_hw_id"); if (media_type == ARPHRD_ETHER) { const char *addr; + const char *parent_subsys; char wireless_path[HAL_PATH_MAX]; char wiphy_path[HAL_PATH_MAX]; - gboolean is_wireless; struct stat s; + dbus_uint64_t mac_address = 0; + + addr = hal_device_property_get_string (d, "net.address"); + if (addr != NULL) { + unsigned int a5, a4, a3, a2, a1, a0; + + if (sscanf (addr, "%x:%x:%x:%x:%x:%x", + &a5, &a4, &a3, &a2, &a1, &a0) == 6) { + mac_address = + ((dbus_uint64_t)a5<<40) | + ((dbus_uint64_t)a4<<32) | + ((dbus_uint64_t)a3<<24) | + ((dbus_uint64_t)a2<<16) | + ((dbus_uint64_t)a1<< 8) | + ((dbus_uint64_t)a0<< 0); + } + } snprintf (wireless_path, HAL_PATH_MAX, "%s/wireless", sysfs_path); /* wireless dscape stack e.g. from rt2500pci driver*/ snprintf (wiphy_path, HAL_PATH_MAX, "%s/wiphy", sysfs_path); - - if ((stat (wireless_path, &s) == 0 && (s.st_mode & S_IFDIR)) || - (stat (wiphy_path, &s) == 0 && (s.st_mode & S_IFDIR))) { + parent_subsys = hal_device_property_get_string (parent_dev, "linux.subsystem"); + + if (parent_subsys && strcmp(parent_subsys, "bluetooth") == 0) { + hal_device_property_set_string (d, "info.product", "Bluetooth Interface"); + hal_device_property_set_string (d, "info.category", "net.bluetooth"); + hal_device_add_capability (d, "net.bluetooth"); + hal_device_property_set_uint64 (d, "net.bluetooth.mac_address", mac_address); + } else if ((stat (wireless_path, &s) == 0 && (s.st_mode & S_IFDIR)) || + (stat (wiphy_path, &s) == 0 && (s.st_mode & S_IFDIR))) { hal_device_property_set_string (d, "info.product", "WLAN Interface"); hal_device_property_set_string (d, "info.category", "net.80211"); hal_device_add_capability (d, "net.80211"); - is_wireless = TRUE; + hal_device_property_set_uint64 (d, "net.80211.mac_address", mac_address); } else { hal_device_property_set_string (d, "info.product", "Networking Interface"); hal_device_property_set_string (d, "info.category", "net.80203"); hal_device_add_capability (d, "net.80203"); - is_wireless = FALSE; - } - - addr = hal_device_property_get_string (d, "net.address"); - if (addr != NULL) { - unsigned int a5, a4, a3, a2, a1, a0; - - if (sscanf (addr, "%x:%x:%x:%x:%x:%x", - &a5, &a4, &a3, &a2, &a1, &a0) == 6) { - dbus_uint64_t mac_address; - - mac_address = - ((dbus_uint64_t)a5<<40) | - ((dbus_uint64_t)a4<<32) | - ((dbus_uint64_t)a3<<24) | - ((dbus_uint64_t)a2<<16) | - ((dbus_uint64_t)a1<< 8) | - ((dbus_uint64_t)a0<< 0); - - hal_device_property_set_uint64 (d, is_wireless ? "net.80211.mac_address" : - "net.80203.mac_address", - mac_address); - } + hal_device_property_set_uint64 (d, "net.80203.mac_address", mac_address); } } else if (media_type == ARPHRD_IRDA) { hal_device_property_set_string (d, "info.product", "Networking Interface"); @@ -504,6 +529,24 @@ error: return d; } +static const char * +net_get_prober (HalDevice *d) +{ + const char *prober = NULL; + + /* run prober only for bluetooth devices */ + if (hal_device_has_capability (d, "net.bluetooth")) { + prober = "hald-probe-net-bluetooth"; + } + + return prober; +} + +static gboolean +net_post_probing (HalDevice *d) +{ + return TRUE; +} static gboolean net_compute_udi (HalDevice *d) @@ -2933,8 +2976,8 @@ static DevHandler dev_handler_net = { .subsystem = "net", .add = net_add, - .get_prober = NULL, - .post_probing = NULL, + .get_prober = net_get_prober, + .post_probing = net_post_probing, .compute_udi = net_compute_udi, .remove = dev_remove };