From: Florian Schilhabel Date: Thu, 13 May 2010 13:55:52 +0200 Subject: [PATCH] Staging: rtl8192su: led update commit 3dfe08e6073f40a742fe3e5d6b43ca8184c55722 upstream. derived from Realteks driver. leds are now working. Signed-off-by: Florian Schilhabel Signed-off-by: Greg Kroah-Hartman [bwh: Adjust context for 2.6.32] --- drivers/staging/rtl8192su/r8192U_core.c | 27 +++++++++++++++++++-------- 1 files changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8192su/r8192U_core.c b/drivers/staging/rtl8192su/r8192U_core.c index 70a8087..78af0d7 100644 --- a/drivers/staging/rtl8192su/r8192U_core.c +++ b/drivers/staging/rtl8192su/r8192U_core.c @@ -1219,6 +1219,7 @@ void rtl8192_set_mode(struct net_device *dev,int mode) void rtl8192_update_msr(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); + LED_CTL_MODE LedAction = LED_CTL_NO_LINK; u8 msr; msr = read_nic_byte(dev, MSR); @@ -1229,19 +1230,23 @@ void rtl8192_update_msr(struct net_device *dev) * this is intentional and make sense for ad-hoc and * master (see the create BSS/IBSS func) */ - if (priv->ieee80211->state == IEEE80211_LINKED){ + if (priv->ieee80211->state == IEEE80211_LINKED) { - if (priv->ieee80211->iw_mode == IW_MODE_INFRA) + if (priv->ieee80211->iw_mode == IW_MODE_INFRA) { msr |= (MSR_LINK_MANAGED<ieee80211->iw_mode == IW_MODE_ADHOC) + LedAction = LED_CTL_LINK; + } else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) msr |= (MSR_LINK_ADHOC<ieee80211->iw_mode == IW_MODE_MASTER) msr |= (MSR_LINK_MASTER<ieee80211->LedControlHandler != NULL) + priv->ieee80211->LedControlHandler(dev, LedAction); } void rtl8192_set_chan(struct net_device *dev,short ch) @@ -2154,15 +2159,13 @@ short rtl8192SU_tx(struct net_device *dev, struct sk_buff* skb) struct r8192_priv *priv = ieee80211_priv(dev); cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tx_desc_819x_usb *tx_desc = (tx_desc_819x_usb *)skb->data; - //tx_fwinfo_819x_usb *tx_fwinfo = (tx_fwinfo_819x_usb *)(skb->data + USB_HWDESC_HEADER_LEN);//92su del struct usb_device *udev = priv->udev; int pend; int status; struct urb *tx_urb = NULL, *tx_urb_zero = NULL; - //int urb_len; unsigned int idx_pipe; - u16 MPDUOverhead = 0; - //RT_DEBUG_DATA(COMP_SEND, tcb_desc, sizeof(cb_desc)); + u16 MPDUOverhead = 0; + u16 type = 0; pend = atomic_read(&priv->tx_pending[tcb_desc->queue_index]); /* we are locked here so the two atomic_read and inc are executed @@ -2359,6 +2362,11 @@ short rtl8192SU_tx(struct net_device *dev, struct sk_buff* skb) skb->data, skb->len, rtl8192_tx_isr, skb); + if (type == IEEE80211_FTYPE_DATA) { + if (priv->ieee80211->LedControlHandler != NULL) + priv->ieee80211->LedControlHandler(dev, LED_CTL_TX); + } + status = usb_submit_urb(tx_urb, GFP_ATOMIC); if (!status){ //we need to send 0 byte packet whenever 512N bytes/64N(HIGN SPEED/NORMAL SPEED) bytes packet has been transmitted. Otherwise, it will be halt to wait for another packet. WB. 2008.08.27 @@ -5487,6 +5495,9 @@ void rtl819x_watchdog_wqcallback(struct work_struct *work) RemovePeerTS(priv->ieee80211,priv->ieee80211->current_network.bssid); ieee->is_roaming = true; priv->ieee80211->link_change(dev); + if(ieee->LedControlHandler != NULL) + ieee->LedControlHandler(ieee->dev, + LED_CTL_START_TO_LINK); queue_work(priv->ieee80211->wq, &priv->ieee80211->associate_procedure_wq); } }