mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2024-11-18 14:47:46 +01:00
parent
ae7afb7cdb
commit
075a46c066
128
package/ar7-atm/patches/170-add-hotplug-status.patch
Normal file
128
package/ar7-atm/patches/170-add-hotplug-status.patch
Normal file
@ -0,0 +1,128 @@
|
||||
diff -urN sangam_atm-D7.03.01.00.orig/tn7dsl.c sangam_atm-D7.03.01.00/tn7dsl.c
|
||||
--- sangam_atm-D7.03.01.00.orig/tn7dsl.c 2008-01-05 03:11:03.000000000 +0100
|
||||
+++ sangam_atm-D7.03.01.00/tn7dsl.c 2008-01-06 18:13:24.000000000 +0000
|
||||
@@ -109,6 +109,11 @@
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/file.h>
|
||||
#include <linux/firmware.h>
|
||||
+#include <linux/skbuff.h>
|
||||
+#include <linux/netlink.h>
|
||||
+#include <net/sock.h>
|
||||
+#include <linux/kobject.h>
|
||||
+#include <asm/uaccess.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/ar7/ar7.h>
|
||||
@@ -296,6 +301,8 @@
|
||||
/* externs */
|
||||
extern struct atm_dev *mydev;
|
||||
extern unsigned int oamFarLBCount[4];
|
||||
+extern struct sock *uevent_sock;
|
||||
+extern u64 uevent_next_seqnum(void);
|
||||
|
||||
/* module wide declars */
|
||||
static PITIDSLHW_T pIhw;
|
||||
@@ -333,6 +340,75 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static inline void add_msg(struct sk_buff *skb, char *msg)
|
||||
+{
|
||||
+ char *scratch;
|
||||
+ scratch = skb_put(skb, strlen(msg) + 1);
|
||||
+ sprintf(scratch, msg);
|
||||
+}
|
||||
+
|
||||
+static void hotplug_dsl_status(void)
|
||||
+{
|
||||
+ struct sk_buff *skb;
|
||||
+ size_t len;
|
||||
+ char *scratch, *dsl_status;
|
||||
+ char buf[128];
|
||||
+ u64 seq;
|
||||
+
|
||||
+ if (!uevent_sock) {
|
||||
+ printk("avsar: unable to create netlink socket!\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ switch (pIhw->AppData.bState)
|
||||
+ {
|
||||
+ case RSTATE_TEST:
|
||||
+ dsl_status="TEST";
|
||||
+ break;
|
||||
+ case RSTATE_IDLE:
|
||||
+ dsl_status="IDLE";
|
||||
+ break;
|
||||
+ case RSTATE_INIT:
|
||||
+ dsl_status="INIT";
|
||||
+ break;
|
||||
+ case RSTATE_HS:
|
||||
+ dsl_status="HANDSHAKE";
|
||||
+ break;
|
||||
+ case RSTATE_RTDL:
|
||||
+ dsl_status="RETRAIN";
|
||||
+ break;
|
||||
+ case RSTATE_SHOWTIME:
|
||||
+ dsl_status="SHOWTIME";
|
||||
+ break;
|
||||
+ default:
|
||||
+ dsl_status="UNKNOWN";
|
||||
+ }
|
||||
+
|
||||
+ /* allocate message with the maximum possible size */
|
||||
+ len = strlen(dsl_status) +2;
|
||||
+ skb = alloc_skb(len + 2048, GFP_KERNEL);
|
||||
+ if (!skb)
|
||||
+ return;
|
||||
+
|
||||
+ /* add header */
|
||||
+ scratch = skb_put(skb, len);
|
||||
+ sprintf(scratch, "%s@",dsl_status);
|
||||
+
|
||||
+ /* copy keys to our continuous event payload buffer */
|
||||
+ add_msg(skb, "HOME=/");
|
||||
+ add_msg(skb, "PATH=/sbin:/bin:/usr/sbin:/usr/bin");
|
||||
+ add_msg(skb, "SUBSYSTEM=atm");
|
||||
+ add_msg(skb, "DEVICENAME=avsar0");
|
||||
+ snprintf(buf, 128, "ACTION=%s", dsl_status);
|
||||
+ add_msg(skb, buf);
|
||||
+ seq = uevent_next_seqnum();
|
||||
+ snprintf(buf, 128, "SEQNUM=%llu", (unsigned long long)seq);
|
||||
+ add_msg(skb, buf);
|
||||
+
|
||||
+ NETLINK_CB(skb).dst_group = 1;
|
||||
+ netlink_broadcast(uevent_sock, skb, 0, 1, GFP_KERNEL);
|
||||
+}
|
||||
+
|
||||
|
||||
int os_atoi(const char *pStr)
|
||||
{
|
||||
@@ -2558,7 +2634,7 @@
|
||||
|
||||
inline int tn7dsl_handle_interrupt(void)
|
||||
{
|
||||
- int intsrc;
|
||||
+ int intsrc,curState;
|
||||
unsigned char cMsgRa[6];
|
||||
short margin;
|
||||
extern unsigned int def_sar_inter_pace; //Sorry
|
||||
@@ -2573,7 +2649,7 @@
|
||||
|
||||
if (nohost_flag) return 0;
|
||||
|
||||
-
|
||||
+ curState=pIhw->AppData.bState;
|
||||
dslhal_api_handleTrainingInterrupt(pIhw, intsrc);
|
||||
|
||||
if(pIhw->lConnected == TC_SYNC)
|
||||
@@ -2704,8 +2780,8 @@
|
||||
}
|
||||
|
||||
#endif
|
||||
-
|
||||
}
|
||||
+ if(pIhw->AppData.bState != curState) hotplug_dsl_status();
|
||||
|
||||
//UR8_MERGE_START CQ10442 Manjula K
|
||||
if (pIhw->AppData.SRA)
|
Loading…
Reference in New Issue
Block a user