rendered paste bodyindex da1785a..c66874f 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -435,48 +435,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 PAN 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");