hal/hald/linux net_class_device.c,1.21.2.3,1.21.2.4
David Zeuthen
david at freedesktop.org
Mon Jan 17 12:00:32 PST 2005
Update of /cvs/hal/hal/hald/linux
In directory gabe:/tmp/cvs-serv17999/hald/linux
Modified Files:
Tag: hal-0_4-stable-branch
net_class_device.c
Log Message:
2005-01-17 David Zeuthen <davidz at redhat.com>
* hald/linux/net_class_device.c (mii_get_rate): Add debug statements
to see if we enter this function
(mii_get_link): Add debug statements to see if we enter
(link_detection_handle_message): Assume link is always 100Mbps
if built with --enable-sysfs-carrier.
(net_class_pre_process): If built with --enable-sysfs-carrier
use sysfs file to check link and assume 100Mbps for speed if
there is a link
* configure.in: Add new --enable-sysfs-carrier option for using
the carrier file in sysfs to determine whether there is link for
networking devices. Right now this will always set the speed to
100Mbps until there is a link (until the Linux kernel exports
this in sysfs also). Requires Linux 2.6.10 or later. Disabled
by default; hald now only uses mii registers if this is disabled.
Index: net_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/net_class_device.c,v
retrieving revision 1.21.2.3
retrieving revision 1.21.2.4
diff -u -d -r1.21.2.3 -r1.21.2.4
--- net_class_device.c 7 Jan 2005 03:07:45 -0000 1.21.2.3
+++ net_class_device.c 17 Jan 2005 20:00:30 -0000 1.21.2.4
@@ -152,6 +152,8 @@
int res;
guint16 link_word;
+ HAL_INFO (("Entering"));
+
ifname = hal_device_property_get_string (d, "net.interface");
sockfd = socket (AF_INET, SOCK_DGRAM, 0);
@@ -217,6 +219,8 @@
int res;
guint16 status_word;
+ HAL_INFO (("Entering"));
+
ifname = hal_device_property_get_string (d, "net.interface");
sockfd = socket (AF_INET, SOCK_DGRAM, 0);
@@ -340,7 +344,12 @@
if (hal_device_has_capability (d, "net.80203")) {
if (!hal_device_property_get_bool (d, "net.80203.link")) {
hal_device_property_set_bool (d, "net.80203.link", TRUE);
+#ifdef SYSFS_CARRIER_ENABLE
+ HAL_INFO (("Assuming link speed is 100Mbps"));
+ hal_device_property_set_uint64 (d, "net.80203.rate", 100 * 1000 * 1000);
+#else /* SYSFS_CARRIER_ENABLE */
mii_get_rate (d);
+#endif /* SYSFS_CARRIER_ENABLE */
}
}
} else {
@@ -617,7 +626,20 @@
if (!is_80211 && media_type == ARPHRD_ETHER) {
/* TODO: for some reason IFF_RUNNING isn't exported in flags */
/*hal_device_property_set_bool (d, "net.80203.link", flags & IFF_RUNNING);*/
+#ifdef SYSFS_CARRIER_ENABLE
+ attr = sysfs_get_classdev_attr (class_device, "carrier");
+ if (attr != NULL) {
+ int have_link;
+
+ have_link = parse_dec (attr->value);
+ HAL_INFO (("According to sysfs link status is %d", have_link));
+ hal_device_property_set_bool (d, "net.80203.link", have_link != 0);
+ HAL_INFO (("Assuming link speed is 100Mbps"));
+ hal_device_property_set_uint64 (d, "net.80203.rate", 100 * 1000 * 1000);
+ }
+#else /* SYSFS_CARRIER_ENABLE */
mii_get_link (d);
+#endif /* SYSFS_CARRIER_ENABLE */
}
}
@@ -653,7 +675,12 @@
if (hal_device_has_property (d, "net.80203.link") &&
hal_device_property_get_bool (d, "net.80203.link")) {
+#ifdef SYSFS_CARRIER_ENABLE
+ HAL_INFO (("Assuming link speed is 100Mbps"));
+ hal_device_property_set_uint64 (d, "net.80203.rate", 100 * 1000 * 1000);
+#else /* SYSFS_CARRIER_ENABLE */
mii_get_rate (d);
+#endif /* SYSFS_CARRIER_ENABLE */
}
hal_device_property_set_int (d, "net.arp_proto_hw_id", media_type);
More information about the hal-commit
mailing list