Lines 45-50
Link Here
|
45 |
#include <linux/input.h> |
45 |
#include <linux/input.h> |
46 |
#endif |
46 |
#endif |
47 |
|
47 |
|
|
|
48 |
/* for wireless extensions */ |
49 |
#include <linux/if.h> |
50 |
#include <linux/wireless.h> |
51 |
|
48 |
#include <dbus/dbus.h> |
52 |
#include <dbus/dbus.h> |
49 |
#include <dbus/dbus-glib.h> |
53 |
#include <dbus/dbus-glib.h> |
50 |
|
54 |
|
Lines 532-541
net_add (const gchar *sysfs_path, const
Link Here
|
532 |
const char *addr; |
536 |
const char *addr; |
533 |
const char *parent_subsys; |
537 |
const char *parent_subsys; |
534 |
char bridge_path[HAL_PATH_MAX]; |
538 |
char bridge_path[HAL_PATH_MAX]; |
535 |
char wireless_path[HAL_PATH_MAX]; |
539 |
char phy80211_path[HAL_PATH_MAX]; |
536 |
char wiphy_path[HAL_PATH_MAX]; |
|
|
537 |
struct stat s; |
540 |
struct stat s; |
538 |
dbus_uint64_t mac_address = 0; |
541 |
dbus_uint64_t mac_address = 0; |
|
|
542 |
int ioctl_fd; |
543 |
struct iwreq iwr; |
544 |
|
545 |
ioctl_fd = socket (PF_INET, SOCK_DGRAM, 0); |
546 |
strncpy (iwr.ifr_ifrn.ifrn_name, ifname, IFNAMSIZ); |
539 |
|
547 |
|
540 |
addr = hal_device_property_get_string (d, "net.address"); |
548 |
addr = hal_device_property_get_string (d, "net.address"); |
541 |
if (addr != NULL) { |
549 |
if (addr != NULL) { |
Lines 554-562
net_add (const gchar *sysfs_path, const
Link Here
|
554 |
} |
562 |
} |
555 |
|
563 |
|
556 |
snprintf (bridge_path, HAL_PATH_MAX, "%s/bridge", sysfs_path); |
564 |
snprintf (bridge_path, HAL_PATH_MAX, "%s/bridge", sysfs_path); |
557 |
snprintf (wireless_path, HAL_PATH_MAX, "%s/wireless", sysfs_path); |
565 |
/* cfg80211 */ |
558 |
/* wireless dscape stack e.g. from rt2500pci driver*/ |
566 |
snprintf (phy80211_path, HAL_PATH_MAX, "%s/phy80211", sysfs_path); |
559 |
snprintf (wiphy_path, HAL_PATH_MAX, "%s/wiphy", sysfs_path); |
|
|
560 |
parent_subsys = hal_device_property_get_string (parent_dev, "info.subsystem"); |
567 |
parent_subsys = hal_device_property_get_string (parent_dev, "info.subsystem"); |
561 |
|
568 |
|
562 |
if (parent_subsys && strcmp(parent_subsys, "bluetooth") == 0) { |
569 |
if (parent_subsys && strcmp(parent_subsys, "bluetooth") == 0) { |
Lines 564-571
net_add (const gchar *sysfs_path, const
Link Here
|
564 |
hal_device_property_set_string (d, "info.category", "net.bluetooth"); |
571 |
hal_device_property_set_string (d, "info.category", "net.bluetooth"); |
565 |
hal_device_add_capability (d, "net.bluetooth"); |
572 |
hal_device_add_capability (d, "net.bluetooth"); |
566 |
hal_device_property_set_uint64 (d, "net.bluetooth.mac_address", mac_address); |
573 |
hal_device_property_set_uint64 (d, "net.bluetooth.mac_address", mac_address); |
567 |
} else if ((stat (wireless_path, &s) == 0 && (s.st_mode & S_IFDIR)) || |
574 |
} else if ((ioctl (ioctl_fd, SIOCGIWNAME, &iwr) == 0) || |
568 |
(stat (wiphy_path, &s) == 0 && (s.st_mode & S_IFDIR))) { |
575 |
(stat (phy80211_path, &s) == 0 && (s.st_mode & S_IFDIR))) { |
569 |
hal_device_property_set_string (d, "info.product", "WLAN Interface"); |
576 |
hal_device_property_set_string (d, "info.product", "WLAN Interface"); |
570 |
hal_device_property_set_string (d, "info.category", "net.80211"); |
577 |
hal_device_property_set_string (d, "info.category", "net.80211"); |
571 |
hal_device_add_capability (d, "net.80211"); |
578 |
hal_device_add_capability (d, "net.80211"); |
Lines 581-586
net_add (const gchar *sysfs_path, const
Link Here
|
581 |
hal_device_add_capability (d, "net.80203"); |
588 |
hal_device_add_capability (d, "net.80203"); |
582 |
hal_device_property_set_uint64 (d, "net.80203.mac_address", mac_address); |
589 |
hal_device_property_set_uint64 (d, "net.80203.mac_address", mac_address); |
583 |
} |
590 |
} |
|
|
591 |
|
592 |
close (ioctl_fd); |
584 |
} else if (media_type == ARPHRD_IRDA) { |
593 |
} else if (media_type == ARPHRD_IRDA) { |
585 |
hal_device_property_set_string (d, "info.product", "Networking Interface"); |
594 |
hal_device_property_set_string (d, "info.product", "Networking Interface"); |
586 |
hal_device_property_set_string (d, "info.category", "net.irda"); |
595 |
hal_device_property_set_string (d, "info.category", "net.irda"); |