hal/hald/linux net_class_device.c,1.21.2.5,1.21.2.6
David Zeuthen
david at freedesktop.org
Thu Jan 27 10:03:41 PST 2005
- Previous message: hal/doc/spec hal-spec.html,1.36.2.15,1.36.2.16
- Next message: hal/po da.po, 1.7.2.5, 1.7.2.6 de.po, 1.8.2.5, 1.8.2.6 fr.po,
1.7.2.5, 1.7.2.6 hu.po, 1.2.2.5, 1.2.2.6 it.po, 1.1.2.3,
1.1.2.4 nl.po, 1.6.2.5, 1.6.2.6 pt.po, 1.2.2.5, 1.2.2.6 ru.po,
1.2.2.5, 1.2.2.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/hal/hal/hald/linux
In directory gabe:/tmp/cvs-serv23237/hald/linux
Modified Files:
Tag: hal-0_4-stable-branch
net_class_device.c
Log Message:
2005-01-27 David Zeuthen <davidz at redhat.com>
* hald/linux/net_class_device.c (net_class_pre_process): Add the
net.80203.can_detect_link property
(mii_get_link): Return a boolean whether we succeeded in determining
link status
Index: net_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/Attic/net_class_device.c,v
retrieving revision 1.21.2.5
retrieving revision 1.21.2.6
diff -u -d -r1.21.2.5 -r1.21.2.6
--- net_class_device.c 27 Jan 2005 16:11:33 -0000 1.21.2.5
+++ net_class_device.c 27 Jan 2005 18:03:39 -0000 1.21.2.6
@@ -209,7 +209,7 @@
g_free (ifr);
}
-static void
+static dbus_bool_t
mii_get_link (HalDevice *d)
{
const char *ifname;
@@ -218,6 +218,7 @@
gboolean new_ioctl_nums;
int res;
guint16 status_word;
+ dbus_bool_t ret;
HAL_INFO (("Entering"));
@@ -227,7 +228,7 @@
if (sockfd < 0) {
HAL_ERROR (("cannot open socket on interface %s; errno=%d",
ifname, errno));
- return;
+ return FALSE;
}
/* reserve some extra space as the sk98lin driver seems to segfault otherwise */
@@ -244,7 +245,7 @@
ifr->ifr_name, strerror (errno)));
close (sockfd);
g_free (ifr);
- return;
+ return FALSE;
}
/* Refer to http://www.scyld.com/diag/mii-status.html for
@@ -266,12 +267,17 @@
res = mdio_read (sockfd, ifr, 1, new_ioctl_nums, &status_word);
res = mdio_read (sockfd, ifr, 1, new_ioctl_nums, &status_word);
+ ret = FALSE;
+
if (res < 0)
HAL_WARNING (("Error reading link info"));
- else if ((status_word & 0x0016) == 0x0004)
+ else if ((status_word & 0x0016) == 0x0004) {
hal_device_property_set_bool (d, "net.80203.link", TRUE);
- else
+ ret = TRUE;
+ } else {
hal_device_property_set_bool (d, "net.80203.link", FALSE);
+ ret = TRUE;
+ }
close (sockfd);
g_free (ifr);
@@ -279,6 +285,7 @@
/* Also get the link rate */
mii_get_rate (d);
+ return ret;
}
static void
@@ -636,9 +643,16 @@
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);
+
+ hal_device_property_set_bool (d, "net.80203.can_detect_link", TRUE);
+ } else {
+ hal_device_property_set_bool (d, "net.80203.can_detect_link", FALSE);
}
#else /* SYSFS_CARRIER_ENABLE */
- mii_get_link (d);
+ if (mii_get_link (d))
+ hal_device_property_set_bool (d, "net.80203.can_detect_link", TRUE);
+ else
+ hal_device_property_set_bool (d, "net.80203.can_detect_link", FALSE);
#endif /* SYSFS_CARRIER_ENABLE */
}
}
- Previous message: hal/doc/spec hal-spec.html,1.36.2.15,1.36.2.16
- Next message: hal/po da.po, 1.7.2.5, 1.7.2.6 de.po, 1.8.2.5, 1.8.2.6 fr.po,
1.7.2.5, 1.7.2.6 hu.po, 1.2.2.5, 1.2.2.6 it.po, 1.1.2.3,
1.1.2.4 nl.po, 1.6.2.5, 1.6.2.6 pt.po, 1.2.2.5, 1.2.2.6 ru.po,
1.2.2.5, 1.2.2.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the hal-commit
mailing list