1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
===================================================================
RCS file: /cvs/hal/hal/hald/linux/Attic/net_class_device.c,v
retrieving revision 1.21.2.3
retrieving revision 1.21.2.4
diff -u -r1.21.2.3 -r1.21.2.4
--- net_class_device.c 2005/01/07 03:07:45 1.21.2.3
+++ net_class_device.c 2005/01/17 20:00:30 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);
|