9979e5171d532e7a71296ae28e31e22e6d0488e8
[vuplus_openvuplus_3.0] / meta-openvuplus / recipes-connectivity / realtek / r8192cu-3.4.4.4749.20121105 / r8192cu_build_fix.patch
1 ################################################################################
2 #      This file is part of OpenELEC - http://www.openelec.tv
3 #      Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
4 #
5 #  OpenELEC is free software: you can redistribute it and/or modify
6 #  it under the terms of the GNU General Public License as published by
7 #  the Free Software Foundation, either version 2 of the License, or
8 #  (at your option) any later version.
9 #
10 #  OpenELEC is distributed in the hope that it will be useful,
11 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #  GNU General Public License for more details.
14 #
15 #  You should have received a copy of the GNU General Public License
16 #  along with OpenELEC.  If not, see <http://www.gnu.org/licenses/>.
17 ################################################################################
18 commit 710c9ba0aab6c2d50b046b22f1405b12b7ebbff3
19 Author: hschang <chang@dev3>
20 Date:   Tue Feb 25 16:49:51 2014 +0900
21
22     patch for lastest kernel(>= 3.10.0)
23
24 diff --git a/core/rtw_debug.c b/core/rtw_debug.c
25 index 04e472d..d4f6e7d 100644
26 --- a/core/rtw_debug.c
27 +++ b/core/rtw_debug.c
28 @@ -62,6 +62,7 @@
29  #ifdef CONFIG_PROC_DEBUG
30  #include <rtw_version.h>
31  
32 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) 
33  int proc_get_drv_version(char *page, char **start,
34                           off_t offset, int count,
35                           int *eof, void *data)
36 @@ -75,7 +76,15 @@ int proc_get_drv_version(char *page, char **start,
37         *eof = 1;
38         return len;
39  }
40 +#else
41 +int proc_get_drv_version(struct seq_file *m, void* data)
42 +{
43 +       seq_printf(m, "%s\n", DRIVERVERSION);
44 +       return 0;
45 +}
46 +#endif
47  
48 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) 
49  int proc_get_write_reg(char *page, char **start,
50                           off_t offset, int count,
51                           int *eof, void *data)
52 @@ -83,7 +92,14 @@ int proc_get_write_reg(char *page, char **start,
53         *eof = 1;
54         return 0;
55  }
56 +#else
57 +int proc_get_write_reg(struct seq_file *m, void* data)
58 +{
59 +       return 0;
60 +}
61 +#endif
62  
63 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) 
64  int proc_set_write_reg(struct file *file, const char *buffer,
65                 unsigned long count, void *data)
66  {
67 @@ -128,10 +144,59 @@ int proc_set_write_reg(struct file *file, const char *buffer,
68         return count;
69         
70  }
71 +#else
72 +int proc_set_write_reg_open(struct seq_file *m, void* data)
73 +{
74 +       return 0;
75 +}
76 +
77 +ssize_t proc_set_write_reg(struct file *file, const char *buffer, size_t count, loff_t *pos)
78 +{
79 +       struct net_device *dev = (struct net_device *)pos;
80 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
81 +       char tmp[32];
82 +       u32 addr, val, len;
83 +
84 +       if (count < 3)
85 +       {
86 +               DBG_8192C("argument size is less than 3\n");
87 +               return -EFAULT;
88 +       }       
89 +       len = min(count, sizeof(tmp)-1);
90 +       if (buffer && !copy_from_user(tmp, buffer, len)) {
91 +               tmp[len] = '\0';
92 +               
93 +               if(sscanf(tmp, "%x %x %x", &addr, &val, &len)!=3) {
94 +                       DBG_8192C("invalid write_reg parameter!\n");
95 +                       return -EFAULT;
96 +               }
97 +
98 +               switch(len)
99 +               {
100 +                       case 1:
101 +                               rtw_write8(padapter, addr, (u8)val);                            
102 +                               break;
103 +                       case 2:
104 +                               rtw_write16(padapter, addr, (u16)val);                          
105 +                               break;
106 +                       case 4:
107 +                               rtw_write32(padapter, addr, val);                               
108 +                               break;
109 +                       default:
110 +                               DBG_8192C("error write length=%d", len);
111 +                               break;
112 +               }                       
113 +               
114 +       }
115 +       
116 +       return count;
117 +}
118 +#endif
119  
120  static u32 proc_get_read_addr=0xeeeeeeee;
121  static u32 proc_get_read_len=0x4;
122  
123 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) 
124  int proc_get_read_reg(char *page, char **start,
125                           off_t offset, int count,
126                           int *eof, void *data)
127 @@ -199,7 +264,77 @@ int proc_set_read_reg(struct file *file, const char *buffer,
128         return count;
129  
130  }
131 +#else
132 +int proc_get_read_reg(struct seq_file *m, void* data)
133 +{      
134 +       struct net_device *dev = m->private;
135 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
136  
137 +       if(proc_get_read_addr==0xeeeeeeee)
138 +       {
139 +               return 0;
140 +       }
141 +
142 +       switch(proc_get_read_len)
143 +       {
144 +               case 1:                 
145 +                       seq_printf(m, "rtw_read8(0x%x)=0x%x\n", proc_get_read_addr, rtw_read8(padapter, proc_get_read_addr));
146 +                       break;
147 +               case 2:
148 +                       seq_printf(m, "rtw_read16(0x%x)=0x%x\n", proc_get_read_addr, rtw_read16(padapter, proc_get_read_addr));
149 +                       break;
150 +               case 4:
151 +                       seq_printf(m, "rtw_read32(0x%x)=0x%x\n", proc_get_read_addr, rtw_read32(padapter, proc_get_read_addr));
152 +                       break;
153 +               default:
154 +                       seq_printf(m, "error read length=%d\n", proc_get_read_len);
155 +                       break;
156 +       }
157 +       return 0;
158 +}
159 +
160 +ssize_t proc_set_read_reg(struct file *file, const char *buf,
161 +               size_t count, loff_t *pos)
162 +{
163 +       struct net_device *dev = (struct net_device *)pos;
164 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
165 +       
166 +       char *cmd, *buffer;
167 +       
168 +       u32 addr, len, num;
169 +
170 +       if (count < 2)
171 +       {
172 +               DBG_8192C("argument size is less than 2\n");
173 +               return -EFAULT;
174 +       }       
175 +       cmd = kmalloc(count+1, GFP_KERNEL);
176 +       if(!cmd)
177 +           return -ENOMEM;
178 +       if(!copy_from_user(cmd, buf, count)) {
179 +
180 +               cmd[count]='\0';
181 +               buffer = cmd;
182 +               
183 +               num = sscanf(buffer, "%x %x", &addr, &len);
184 +
185 +               if (num !=  2) {
186 +                       DBG_8192C("invalid read_reg parameter!\n");
187 +                       return count;
188 +               }
189 +
190 +               proc_get_read_addr = addr;
191 +               proc_get_read_len = len;
192 +       }else{
193 +           kfree(cmd);
194 +           return -EFAULT;
195 +       }
196 +       kfree(cmd);
197 +       return count;
198 +}
199 +#endif
200 +
201 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
202  int proc_get_fwstate(char *page, char **start,
203                           off_t offset, int count,
204                           int *eof, void *data)
205 @@ -215,7 +350,18 @@ int proc_get_fwstate(char *page, char **start,
206         *eof = 1;
207         return len;
208  }
209 +#else
210 +int proc_get_fwstate(struct seq_file *m, void* data)
211 +{
212 +       struct net_device *dev = m->private;
213 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
214 +       struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
215 +       seq_printf(m, "fwstate=0x%x\n",get_fwstate(pmlmepriv));
216 +       return 0;
217 +}
218 +#endif
219  
220 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
221  int proc_get_sec_info(char *page, char **start,
222                           off_t offset, int count,
223                           int *eof, void *data)
224 @@ -233,7 +379,20 @@ int proc_get_sec_info(char *page, char **start,
225         *eof = 1;
226         return len;
227  }
228 +#else
229 +int proc_get_sec_info(struct seq_file *m, void* data)
230 +{
231 +       struct net_device *dev = m->private;
232 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
233 +       struct security_priv *psecuritypriv = &padapter->securitypriv;
234 +       seq_printf(m, "auth_alg=0x%x, enc_alg=0x%x, auth_type=0x%x, enc_type=0x%x\n", 
235 +                                               psecuritypriv->dot11AuthAlgrthm, psecuritypriv->dot11PrivacyAlgrthm,
236 +                                               psecuritypriv->ndisauthtype, psecuritypriv->ndisencryptstatus);
237 +       return 0;
238 +}
239 +#endif
240  
241 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
242  int proc_get_mlmext_state(char *page, char **start,
243                           off_t offset, int count,
244                           int *eof, void *data)
245 @@ -250,7 +409,19 @@ int proc_get_mlmext_state(char *page, char **start,
246         *eof = 1;
247         return len;
248  }
249 +#else
250 +int proc_get_mlmext_state(struct seq_file *m, void *data)
251 +{
252 +       struct net_device *dev = m->private;
253 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);  
254 +       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
255 +       struct mlme_ext_info    *pmlmeinfo = &(pmlmeext->mlmext_info);
256 +       seq_printf(m, "pmlmeinfo->state=0x%x\n", pmlmeinfo->state);
257 +       return 0;
258 +}
259 +#endif
260  
261 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
262  int proc_get_qos_option(char *page, char **start,
263                           off_t offset, int count,
264                           int *eof, void *data)
265 @@ -267,7 +438,18 @@ int proc_get_qos_option(char *page, char **start,
266         return len;
267  
268  }
269 +#else
270 +int proc_get_qos_option(struct seq_file *m, void *data)
271 +{
272 +       struct net_device *dev = m->private;
273 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
274 +       struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
275 +       seq_printf(m, "qos_option=%d\n", pmlmepriv->qospriv.qos_option);
276 +       return 0;
277 +}
278 +#endif
279  
280 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
281  int proc_get_ht_option(char *page, char **start,
282                           off_t offset, int count,
283                           int *eof, void *data)
284 @@ -283,7 +465,18 @@ int proc_get_ht_option(char *page, char **start,
285         *eof = 1;
286         return len;
287  }
288 +#else
289 +int proc_get_ht_option(struct seq_file *m, void *data)
290 +{
291 +       struct net_device *dev = m->private;
292 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
293 +       struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
294 +       seq_printf(m, "ht_option=%d\n", pmlmepriv->htpriv.ht_option);
295 +       return 0;
296 +}
297 +#endif
298  
299 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
300  int proc_get_rf_info(char *page, char **start,
301                           off_t offset, int count,
302                           int *eof, void *data)
303 @@ -301,7 +494,19 @@ int proc_get_rf_info(char *page, char **start,
304         return len;
305  
306  }
307 +#else
308 +int proc_get_rf_info(struct seq_file *m, void *data)
309 +{
310 +       struct net_device *dev = m->private;
311 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);  
312 +       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;     
313 +       seq_printf(m, "cur_ch=%d, cur_bw=%d, cur_ch_offet=%d\n",
314 +                       pmlmeext->cur_channel, pmlmeext->cur_bwmode, pmlmeext->cur_ch_offset);
315 +       return 0;
316 +}
317 +#endif
318  
319 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
320  int proc_get_ap_info(char *page, char **start,
321                           off_t offset, int count,
322                           int *eof, void *data)
323 @@ -350,7 +555,53 @@ int proc_get_ap_info(char *page, char **start,
324         return len;
325  
326  }
327 +#else
328 +int proc_get_ap_info(struct seq_file *m, void *data)
329 +{
330 +       struct sta_info *psta;
331 +       struct net_device *dev = m->private;
332 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
333 +       struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
334 +       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
335 +       struct wlan_network *cur_network = &(pmlmepriv->cur_network);
336 +       struct sta_priv *pstapriv = &padapter->stapriv;
337 +       int len = 0;
338 +
339 +       psta = rtw_get_stainfo(pstapriv, cur_network->network.MacAddress);
340 +       if(psta)
341 +       {
342 +               int i;
343 +               struct recv_reorder_ctrl *preorder_ctrl;
344 +                                       
345 +               seq_printf(m, "SSID=%s\n", cur_network->network.Ssid.Ssid);             
346 +               seq_printf(m, "sta's macaddr:" MAC_FMT "\n", MAC_ARG(psta->hwaddr));
347 +               seq_printf(m, "cur_channel=%d, cur_bwmode=%d, cur_ch_offset=%d\n", pmlmeext->cur_channel, pmlmeext->cur_bwmode, pmlmeext->cur_ch_offset);               
348 +               seq_printf(m, "rtsen=%d, cts2slef=%d\n", psta->rtsen, psta->cts2self);
349 +               seq_printf(m, "qos_en=%d, ht_en=%d, init_rate=%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate);        
350 +               seq_printf(m, "state=0x%x, aid=%d, macid=%d, raid=%d\n", psta->state, psta->aid, psta->mac_id, psta->raid);     
351 +               seq_printf(m, "bwmode=%d, ch_offset=%d, sgi=%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi);                                              
352 +               seq_printf(m, "ampdu_enable = %d\n", psta->htpriv.ampdu_enable);        
353 +               seq_printf(m, "agg_enable_bitmap=%x, candidate_tid_bitmap=%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap);
354 +                                       
355 +               for(i=0;i<16;i++)
356 +               {                                                       
357 +                       preorder_ctrl = &psta->recvreorder_ctrl[i];
358 +                       if(preorder_ctrl->enable)
359 +                       {
360 +                               seq_printf(m, "tid=%d, indicate_seq=%d\n", i, preorder_ctrl->indicate_seq);
361 +                       }
362 +               }       
363 +               
364 +       }
365 +       else
366 +       {
367 +               seq_printf(m, "can't get sta's macaddr, cur_network's macaddr:" MAC_FMT "\n", MAC_ARG(cur_network->network.MacAddress));
368 +       }
369 +       return 0;
370 +}
371 +#endif
372  
373 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
374  int proc_get_adapter_state(char *page, char **start,
375                           off_t offset, int count,
376                           int *eof, void *data)
377 @@ -366,7 +617,18 @@ int proc_get_adapter_state(char *page, char **start,
378         return len;
379  
380  }
381 -       
382 +#else
383 +int proc_get_adapter_state(struct seq_file *m, void *data)
384 +{
385 +       struct net_device *dev = m->private;
386 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
387 +       seq_printf(m, "bSurpriseRemoved=%d, bDriverStopped=%d\n", 
388 +                       padapter->bSurpriseRemoved, padapter->bDriverStopped);
389 +       return 0;
390 +}
391 +#endif
392 +
393 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
394  int proc_get_trx_info(char *page, char **start,
395                           off_t offset, int count,
396                           int *eof, void *data)
397 @@ -387,8 +649,23 @@ int proc_get_trx_info(char *page, char **start,
398         return len;
399  
400  }
401 -       
402 -               
403 +#else
404 +int proc_get_trx_info(struct seq_file *m, void *data)
405 +{
406 +       struct net_device *dev = m->private;
407 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
408 +       struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
409 +       struct recv_priv  *precvpriv = &padapter->recvpriv;
410 +       seq_printf(m, "free_xmitbuf_cnt=%d, free_xmitframe_cnt=%d, free_ext_xmitbuf_cnt=%d, free_recvframe_cnt=%d\n", 
411 +               pxmitpriv->free_xmitbuf_cnt, pxmitpriv->free_xmitframe_cnt,pxmitpriv->free_xmit_extbuf_cnt, precvpriv->free_recvframe_cnt);
412 +#ifdef CONFIG_USB_HCI
413 +       seq_printf(m, "rx_urb_pending_cn=%d\n", precvpriv->rx_pending_cnt);
414 +#endif
415 +       return 0;
416 +}
417 +#endif
418 +
419 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
420  int proc_get_rx_signal(char *page, char **start,
421                           off_t offset, int count,
422                           int *eof, void *data)
423 @@ -452,7 +729,62 @@ int proc_set_rx_signal(struct file *file, const char *buffer,
424         return count;
425         
426  }
427 +#else
428 +int proc_get_rx_signal(struct seq_file *m, void *data)
429 +{
430 +       struct net_device *dev = m->private;
431 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
432 +       struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
433 +       seq_printf(m,
434 +               "rssi:%d\n"
435 +               "rxpwdb:%d\n"
436 +               "signal_strength:%u\n"
437 +               "signal_qual:%u\n"
438 +               "noise:%u\n", 
439 +               padapter->recvpriv.rssi,
440 +               padapter->recvpriv.rxpwdb,
441 +               padapter->recvpriv.signal_strength,
442 +               padapter->recvpriv.signal_qual,
443 +               padapter->recvpriv.noise
444 +               );
445 +       return 0;
446 +}
447  
448 +ssize_t proc_set_rx_signal(struct file *file, const char *buffer, size_t count, loff_t *pos)
449 +{
450 +       struct net_device *dev = (struct net_device *)pos;
451 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
452 +       char tmp[32];
453 +       u32 is_signal_dbg, signal_strength;
454 +
455 +       if (count < 1)
456 +               return -EFAULT;
457 +
458 +       if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
459 +
460 +               int num = sscanf(tmp, "%u %u", &is_signal_dbg, &signal_strength);
461 +
462 +               is_signal_dbg = is_signal_dbg==0?0:1;
463 +               
464 +               if(is_signal_dbg && num!=2)
465 +                       return count;
466 +                       
467 +               signal_strength = signal_strength>100?100:signal_strength;
468 +               signal_strength = signal_strength<0?0:signal_strength;
469 +
470 +               padapter->recvpriv.is_signal_dbg = is_signal_dbg;
471 +               padapter->recvpriv.signal_strength_dbg=signal_strength;
472 +
473 +               if(is_signal_dbg)
474 +                       DBG_871X("set %s %u\n", "DBG_SIGNAL_STRENGTH", signal_strength);
475 +               else
476 +                       DBG_871X("set %s\n", "HW_SIGNAL_STRENGTH");
477 +       }
478 +       return count;
479 +}
480 +#endif
481 +
482 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
483  int proc_get_ampdu_enable(char *page, char **start,
484                           off_t offset, int count,
485                           int *eof, void *data)
486 @@ -499,7 +831,46 @@ int proc_set_ampdu_enable(struct file *file, const char *buffer,
487         return count;
488         
489  }
490 +#else
491 +int proc_get_ampdu_enable(struct seq_file *m, void *data)
492 +{
493 +       struct net_device *dev = m->private;
494 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
495 +       struct registry_priv    *pregpriv = &padapter->registrypriv;
496 +       if(pregpriv)
497 +               seq_printf(m,
498 +                       "%d\n",
499 +                       pregpriv->ampdu_enable
500 +                       );
501 +       return 0;
502 +}
503 +
504 +ssize_t proc_set_ampdu_enable(struct file *file, const char *buffer, size_t count, loff_t *pos)
505 +{
506 +       struct net_device *dev = (struct net_device *)pos;
507 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
508 +       struct registry_priv    *pregpriv = &padapter->registrypriv;
509 +       char tmp[32];
510 +       u32 mode;
511 +
512 +       if (count < 1)
513 +               return -EFAULT;
514 +
515 +       if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {              
516 +
517 +               int num = sscanf(tmp, "%d ", &mode);
518 +
519 +               if( pregpriv && mode >= 0 && mode < 3 )
520 +               {
521 +                       pregpriv->ampdu_enable= mode;
522 +                       printk("ampdu_enable=%d\n", mode);
523 +               }
524 +       }
525 +       return count;
526 +}
527 +#endif
528  
529 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
530  int proc_get_rssi_disp(char *page, char **start,
531                           off_t offset, int count,
532                           int *eof, void *data)
533 @@ -547,10 +918,52 @@ int proc_set_rssi_disp(struct file *file, const char *buffer,
534         return count;
535         
536  }      
537 +#else
538 +int proc_get_rssi_disp(struct seq_file *m, void *data)
539 +{
540 +       return 0;
541 +}
542 +
543 +ssize_t proc_set_rssi_disp(struct file *file, const char *buffer, size_t count, loff_t *pos)
544 +{
545 +       struct net_device *dev = (struct net_device *)pos;
546 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
547 +       char tmp[32];
548 +       u32 enable=0;
549  
550 +       if (count < 1)
551 +       {
552 +               DBG_8192C("argument size is less than 1\n");
553 +               return -EFAULT;
554 +       }       
555 +
556 +       if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {              
557 +
558 +               int num = sscanf(tmp, "%x", &enable);
559 +
560 +               if (num !=  1) {
561 +                       DBG_8192C("invalid set_rssi_disp parameter!\n");
562 +                       return count;
563 +               }
564                 
565 +               if(enable)
566 +               {                       
567 +                       DBG_8192C("Turn On Rx RSSI Display Function\n");
568 +                       padapter->bRxRSSIDisplay = enable ;                     
569 +               }
570 +               else
571 +               {
572 +                       DBG_8192C("Turn Off Rx RSSI Display Function\n");
573 +                       padapter->bRxRSSIDisplay = 0 ;
574 +               }
575 +       }
576 +       return count;
577 +}
578 +#endif
579 +
580  #ifdef CONFIG_AP_MODE
581  
582 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
583  int proc_get_all_sta_info(char *page, char **start,
584                           off_t offset, int count,
585                           int *eof, void *data)
586 @@ -620,14 +1033,74 @@ int proc_get_all_sta_info(char *page, char **start,
587         return len;
588  
589  }
590 -       
591 -#endif         
592 +#else
593 +int proc_get_all_sta_info(struct seq_file *m, void *data)
594 +{
595 +       _irqL irqL;
596 +       struct sta_info *psta;
597 +       struct net_device *dev = m->private;
598 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
599 +       struct sta_priv *pstapriv = &padapter->stapriv;
600 +       int i, j;
601 +       _list   *plist, *phead;
602 +       struct recv_reorder_ctrl *preorder_ctrl;
603 +       seq_printf(m, "sta_dz_bitmap=0x%x, tim_bitmap=0x%x\n", pstapriv->sta_dz_bitmap, pstapriv->tim_bitmap);
604 +                                       
605 +       _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
606 +
607 +       for(i=0; i< NUM_STA; i++)
608 +       {
609 +               phead = &(pstapriv->sta_hash[i]);
610 +               plist = get_next(phead);
611 +               
612 +               while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
613 +               {
614 +                       psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
615 +
616 +                       plist = get_next(plist);
617 +
618 +                       //if(extra_arg == psta->aid)
619 +                       {
620 +                               seq_printf(m, "sta's macaddr:" MAC_FMT "\n", MAC_ARG(psta->hwaddr));
621 +                               seq_printf(m, "rtsen=%d, cts2slef=%d\n", psta->rtsen, psta->cts2self);
622 +                               seq_printf(m, "qos_en=%d, ht_en=%d, init_rate=%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate);        
623 +                               seq_printf(m, "state=0x%x, aid=%d, macid=%d, raid=%d\n", psta->state, psta->aid, psta->mac_id, psta->raid);     
624 +                               seq_printf(m, "bwmode=%d, ch_offset=%d, sgi=%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi);                                              
625 +                               seq_printf(m, "ampdu_enable = %d\n", psta->htpriv.ampdu_enable);                                                                        
626 +                               seq_printf(m, "agg_enable_bitmap=%x, candidate_tid_bitmap=%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap);
627 +                               seq_printf(m, "sleepq_len=%d\n", psta->sleepq_len);
628 +                               seq_printf(m, "capability=0x%x\n", psta->capability);
629 +                               seq_printf(m, "flags=0x%x\n", psta->flags);
630 +                               seq_printf(m, "wpa_psk=0x%x\n", psta->wpa_psk);
631 +                               seq_printf(m, "wpa2_group_cipher=0x%x\n", psta->wpa2_group_cipher);
632 +                               seq_printf(m, "wpa2_pairwise_cipher=0x%x\n", psta->wpa2_pairwise_cipher);
633 +                               seq_printf(m, "qos_info=0x%x\n", psta->qos_info);
634 +                               seq_printf(m, "dot118021XPrivacy=0x%x\n", psta->dot118021XPrivacy);
635 +                                                               
636 +                               for(j=0;j<16;j++)
637 +                               {                                                       
638 +                                       preorder_ctrl = &psta->recvreorder_ctrl[j];
639 +                                       if(preorder_ctrl->enable)
640 +                                       {
641 +                                               seq_printf(m, "tid=%d, indicate_seq=%d\n", j, preorder_ctrl->indicate_seq);
642 +                                       }
643 +                               }
644 +                       }
645 +               }
646 +       }
647 +       _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
648 +       return 0;
649 +}
650 +#endif
651 +
652 +#endif
653  
654  #ifdef DBG_MEMORY_LEAK
655  #include <asm/atomic.h>
656  extern atomic_t _malloc_cnt;;
657  extern atomic_t _malloc_size;;
658  
659 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
660  int proc_get_malloc_cnt(char *page, char **start,
661                           off_t offset, int count,
662                           int *eof, void *data)
663 @@ -641,9 +1114,20 @@ int proc_get_malloc_cnt(char *page, char **start,
664         *eof = 1;
665         return len;
666  }
667 +#else
668 +int proc_get_malloc_cnt(struct seq_file *m, void *data)
669 +{
670 +       seq_printf(m, "_malloc_cnt=%d\n", atomic_read(&_malloc_cnt));
671 +       seq_printf(m, "_malloc_size=%d\n", atomic_read(&_malloc_size));
672 +       return 0;
673 +}
674 +#endif
675 +
676  #endif /* DBG_MEMORY_LEAK */
677  
678  #ifdef CONFIG_FIND_BEST_CHANNEL
679 +
680 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
681  int proc_get_best_channel(char *page, char **start,
682                           off_t offset, int count,
683                           int *eof, void *data)
684 @@ -703,6 +1187,61 @@ int proc_get_best_channel(char *page, char **start,
685         return len;
686  
687  }
688 +#else
689 +int proc_get_best_channel(struct seq_file *m, void *data)
690 +{
691 +       struct net_device *dev = m->private;
692 +       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
693 +       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
694 +       u32 i, best_channel_24G = 1, best_channel_5G = 36, index_24G = 0, index_5G = 0;
695 +
696 +       for (i=0; pmlmeext->channel_set[i].ChannelNum !=0; i++) {
697 +               if ( pmlmeext->channel_set[i].ChannelNum == 1)
698 +                       index_24G = i;
699 +               if ( pmlmeext->channel_set[i].ChannelNum == 36)
700 +                       index_5G = i;
701 +       }       
702 +       
703 +       for (i=0; pmlmeext->channel_set[i].ChannelNum !=0; i++) {
704 +               // 2.4G
705 +               if ( pmlmeext->channel_set[i].ChannelNum == 6 ) {
706 +                       if ( pmlmeext->channel_set[i].rx_count < pmlmeext->channel_set[index_24G].rx_count ) {
707 +                               index_24G = i;
708 +                               best_channel_24G = pmlmeext->channel_set[i].ChannelNum;
709 +                       }
710 +               }
711 +
712 +               // 5G
713 +               if ( pmlmeext->channel_set[i].ChannelNum >= 36
714 +                       && pmlmeext->channel_set[i].ChannelNum < 140 ) {
715 +                        // Find primary channel
716 +                       if ( (( pmlmeext->channel_set[i].ChannelNum - 36) % 8 == 0)
717 +                               && (pmlmeext->channel_set[i].rx_count < pmlmeext->channel_set[index_5G].rx_count) ) {
718 +                               index_5G = i;
719 +                               best_channel_5G = pmlmeext->channel_set[i].ChannelNum;
720 +                       }
721 +               }
722 +
723 +               if ( pmlmeext->channel_set[i].ChannelNum >= 149
724 +                       && pmlmeext->channel_set[i].ChannelNum < 165) {
725 +                        // find primary channel
726 +                       if ( (( pmlmeext->channel_set[i].ChannelNum - 149) % 8 == 0)
727 +                               && (pmlmeext->channel_set[i].rx_count < pmlmeext->channel_set[index_5G].rx_count) ) {
728 +                               index_5G = i;
729 +                               best_channel_5G = pmlmeext->channel_set[i].ChannelNum;
730 +                       }
731 +               }
732 +#if 1 // debug
733 +               seq_printf(m, "The rx cnt of channel %3d = %d\n", 
734 +                               pmlmeext->channel_set[i].ChannelNum, pmlmeext->channel_set[i].rx_count);
735 +#endif
736 +       }
737 +       seq_printf(m, "best_channel_5G = %d\n", best_channel_5G);
738 +       seq_printf(m, "best_channel_24G = %d\n", best_channel_24G);
739 +       return 0;
740 +}
741 +#endif
742 +
743  #endif /* CONFIG_FIND_BEST_CHANNEL */
744         
745  #endif
746 diff --git a/core/rtw_mp.c b/core/rtw_mp.c
747 index 0cdc094..bb76dae 100644
748 --- a/core/rtw_mp.c
749 +++ b/core/rtw_mp.c
750 @@ -1140,8 +1140,7 @@ void SetPacketTx(PADAPTER padapter)
751         _rtw_memset(ptr, payload, pkt_end - ptr);
752  
753         //3 6. start thread
754 -       pmp_priv->tx.PktTxThread = kernel_thread(mp_xmit_packet_thread, pmp_priv, CLONE_FS|CLONE_FILES);
755 -       if(pmp_priv->tx.PktTxThread < 0)
756 +       if(!start_kthread(&pmp_priv->tx.PktTxThread, mp_xmit_packet_thread, pmp_priv, "8192cu-mp-xmit"))
757                 DBG_871X("Create PktTx Thread Fail !!!!!\n");
758  
759  }
760 diff --git a/hal/rtl8192c/usb/usb_halinit.c b/hal/rtl8192c/usb/usb_halinit.c
761 index eb5ea29..6cac2d5 100644
762 --- a/hal/rtl8192c/usb/usb_halinit.c
763 +++ b/hal/rtl8192c/usb/usb_halinit.c
764 @@ -3786,6 +3786,8 @@ _ReadIDs(
765                                 pHalData->CustomerID = RT_CID_DLINK;
766                         else if((pHalData->EEPROMVID == 0x2001) && (pHalData->EEPROMPID == 0x330a))
767                                 pHalData->CustomerID = RT_CID_DLINK;
768 +                       else if((pHalData->EEPROMVID == 0x2001) && (pHalData->EEPROMPID == 0x330d))
769 +                               pHalData->CustomerID = RT_CID_DLINK;
770                         break;
771                 case EEPROM_CID_WHQL:
772  /*                     
773 diff --git a/include/osdep_service.h b/include/osdep_service.h
774 index 2802187..6fedff4 100644
775 --- a/include/osdep_service.h
776 +++ b/include/osdep_service.h
777 @@ -100,6 +100,9 @@
778         #include <linux/pci.h>
779  #endif
780  
781 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
782 +       #include <linux/kthread.h>
783 +#endif
784         
785  #ifdef CONFIG_USB_HCI
786         typedef struct urb *  PURB;
787 @@ -133,8 +136,12 @@
788         //typedef u32   _irqL;
789         typedef unsigned long _irqL;
790         typedef struct  net_device * _nic_hdl;
791 -       
792 +
793 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
794         typedef pid_t           _thread_hdl_;
795 +#else
796 +       typedef struct task_struct * _thread_hdl_;
797 +#endif
798         typedef int             thread_return;
799         typedef void*   thread_context;
800  
801 @@ -572,7 +579,7 @@ __inline static void thread_enter(void *context)
802  #ifdef PLATFORM_LINUX
803         //struct net_device *pnetdev = (struct net_device *)context;
804         //daemonize("%s", pnetdev->name);
805 -       daemonize("%s", "RTKTHREAD");
806 +       //daemonize("%s", "RTKTHREAD");
807         allow_signal(SIGTERM);
808  #endif
809  }
810 @@ -827,4 +834,8 @@ extern u64 rtw_division64(u64 x, u64 y);
811  
812  #endif
813  
814 +#ifdef PLATFORM_LINUX
815 +extern int start_kthread(_thread_hdl_ *t_hdl, int (*threadfn)(void *data),
816 +                        void *data, const char *name);
817 +#endif
818  
819 diff --git a/include/rtw_debug.h b/include/rtw_debug.h
820 index eca6692..624add6 100644
821 --- a/include/rtw_debug.h
822 +++ b/include/rtw_debug.h
823 @@ -24,7 +24,6 @@
824  #include <osdep_service.h>
825  #include <drv_types.h>
826  
827 -
828  #define _drv_emerg_                    1
829  #define _drv_alert_                    2
830  #define _drv_crit_                     3
831 @@ -35,7 +34,6 @@
832  #define _drv_dump_                     8
833  #define        _drv_debug_             9
834  
835 -
836  #define        _module_rtl871x_xmit_c_                 BIT(0)
837  #define        _module_xmit_osdep_c_           BIT(1)
838  #define        _module_rtl871x_recv_c_                 BIT(2)
839 @@ -179,7 +177,6 @@ extern void rtl871x_cedbg(const char *fmt, ...);
840  
841  #endif /* CONFIG_DEBUG_RTL871X */
842  
843 -
844  #if    defined (_dbgdump) && defined (_MODULE_DEFINE_)
845  
846                 #undef RT_TRACE
847 @@ -193,7 +190,6 @@ extern void rtl871x_cedbg(const char *fmt, ...);
848  
849  #endif
850  
851 -
852  #if    defined (_dbgdump)
853  
854                 #undef  _func_enter_
855 @@ -231,7 +227,6 @@ extern void rtl871x_cedbg(const char *fmt, ...);
856                         }
857  #endif
858  
859 -
860  #ifdef CONFIG_DEBUG_RTL819X
861         #ifdef PLATFORM_WINDOWS
862  
863 @@ -281,10 +276,9 @@ extern void rtl871x_cedbg(const char *fmt, ...);
864         #define ERR_8192C _dbgdump
865  #endif
866  
867 -
868 -
869  #ifdef CONFIG_PROC_DEBUG
870  
871 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
872         int proc_get_drv_version(char *page, char **start,
873                           off_t offset, int count,
874                           int *eof, void *data);
875 @@ -293,8 +287,8 @@ extern void rtl871x_cedbg(const char *fmt, ...);
876                           off_t offset, int count,
877                           int *eof, void *data);
878  
879 -       int proc_set_write_reg(struct file *file, const char *buffer,
880 -               unsigned long count, void *data);
881 +       int proc_set_write_reg(struct file *file, const char *buffer,
882 +                         unsigned long count, void *data);
883  
884         int proc_get_read_reg(char *page, char **start,
885                           off_t offset, int count,
886 @@ -303,7 +297,6 @@ extern void rtl871x_cedbg(const char *fmt, ...);
887         int proc_set_read_reg(struct file *file, const char *buffer,
888                 unsigned long count, void *data);
889  
890 -
891         int proc_get_fwstate(char *page, char **start,
892                           off_t offset, int count,
893                           int *eof, void *data);
894 @@ -339,28 +332,75 @@ extern void rtl871x_cedbg(const char *fmt, ...);
895         int proc_get_trx_info(char *page, char **start,
896                           off_t offset, int count,
897                           int *eof, void *data);
898 +#else
899 +       int proc_get_drv_version(struct seq_file *m, void *data);
900 +
901 +       int proc_get_write_reg(struct seq_file *m, void *data);
902 +
903 +       ssize_t proc_set_write_reg(struct file *file, const char *buffer,
904 +                        size_t count, loff_t *pos);
905 +
906 +       int proc_get_read_reg(struct seq_file *m, void *data);
907 +
908 +       ssize_t proc_set_read_reg(struct file *file, const char *buffer,
909 +                        size_t count, loff_t *pos);
910 +
911 +       int proc_get_fwstate(struct seq_file *m, void *data);
912 +
913 +       int proc_get_sec_info(struct seq_file *m, void *data);
914 +
915 +       int proc_get_mlmext_state(struct seq_file *m, void *data);
916  
917 +       int proc_get_qos_option(struct seq_file *m, void *data);
918 +
919 +       int proc_get_ht_option(struct seq_file *m, void *data);
920 +
921 +       int proc_get_rf_info(struct seq_file *m, void *data);
922 +
923 +       int proc_get_ap_info(struct seq_file *m, void *data);
924 +
925 +       int proc_get_adapter_state(struct seq_file *m, void *data);
926 +
927 +       int proc_get_trx_info(struct seq_file *m, void *data);
928 +#endif
929  
930  #ifdef CONFIG_AP_MODE
931  
932 +# if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
933         int proc_get_all_sta_info(char *page, char **start,
934                           off_t offset, int count,
935                           int *eof, void *data);
936 +# else
937 +       int proc_get_all_sta_info(struct seq_file *m, void *data);
938 +# endif
939  
940  #endif
941  
942  #ifdef DBG_MEMORY_LEAK
943 +
944 +# if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
945         int proc_get_malloc_cnt(char *page, char **start,
946                           off_t offset, int count,
947                           int *eof, void *data);
948 +# else
949 +       int proc_get_malloc_cnt(struct seq_file *m, void *data);
950 +# endif
951 +
952  #endif
953  
954  #ifdef CONFIG_FIND_BEST_CHANNEL
955 +
956 +# if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
957         int proc_get_best_channel(char *page, char **start,
958                           off_t offset, int count,
959                           int *eof, void *data);
960 +# else
961 +       int proc_get_best_channel(struct seq_file *m, void *data);
962 +# endif
963 +
964  #endif
965  
966 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
967         int proc_get_rx_signal(char *page, char **start,
968                           off_t offset, int count,
969                           int *eof, void *data);
970 @@ -381,7 +421,22 @@ extern void rtl871x_cedbg(const char *fmt, ...);
971  
972         int proc_set_rssi_disp(struct file *file, const char *buffer,
973                 unsigned long count, void *data);
974 -       
975 +#else
976 +       int proc_get_rx_signal(struct seq_file *m, void *data);
977 +
978 +       ssize_t proc_set_rx_signal(struct file *file, const char *buffer,
979 +                               size_t count, loff_t *pos);
980 +
981 +       int proc_get_ampdu_enable(struct seq_file *m, void *data);
982 +                         
983 +       ssize_t proc_set_ampdu_enable(struct file *file, const char *buffer,
984 +                               size_t count, loff_t *pos);
985 +
986 +       int proc_get_rssi_disp(struct seq_file *m, void *data);
987 +
988 +       ssize_t proc_set_rssi_disp(struct file *file, const char *buffer,
989 +                               size_t count, loff_t *pos);
990 +#endif
991  
992  #endif //CONFIG_PROC_DEBUG
993  
994 diff --git a/include/rtw_recv.h b/include/rtw_recv.h
995 index a88f505..e204ef3 100644
996 --- a/include/rtw_recv.h
997 +++ b/include/rtw_recv.h
998 @@ -623,8 +623,9 @@ __inline static union recv_frame *rxmem_to_recvframe(u8 *rxmem)
999         //from any given member of recv_frame.
1000         // rxmem indicates the any member/address in recv_frame
1001         
1002 -       return (union recv_frame*)(((uint)rxmem>>RXFRAME_ALIGN) <<RXFRAME_ALIGN) ;
1003 -       
1004 +       //return (union recv_frame*)(((uint)rxmem>>RXFRAME_ALIGN) <<RXFRAME_ALIGN) ;
1005 +       //return (union recv_frame*)(((SIZE_PTR)rxmem >> RXFRAME_ALIGN) << RXFRAME_ALIGN);
1006 +       return (union recv_frame*)(((ulong)rxmem>>RXFRAME_ALIGN) <<RXFRAME_ALIGN) ; 
1007  }
1008  
1009  __inline static union recv_frame *pkt_to_recvframe(_pkt *pkt)
1010 diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c
1011 index 4d057a6..d3b662c 100644
1012 --- a/os_dep/linux/os_intfs.c
1013 +++ b/os_dep/linux/os_intfs.c
1014 @@ -255,6 +255,246 @@ static char rtw_proc_name[IFNAMSIZ];
1015  static struct proc_dir_entry *rtw_proc = NULL;
1016  static int     rtw_proc_cnt = 0;
1017  
1018 +/*
1019 + * seq_file wrappers for procfile show routines, kernel >= 3.10
1020 + */
1021 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
1022 +
1023 +static int proc_get_drv_version_open(struct inode *inode, struct file *file){
1024 +        return single_open(file, proc_get_drv_version, PDE_DATA(inode));
1025 +}
1026 +
1027 +static const struct file_operations proc_get_drv_version_fops = {
1028 +        .owner = THIS_MODULE,
1029 +       .open = proc_get_drv_version_open,
1030 +        .read = seq_read,
1031 +        .llseek = seq_lseek,
1032 +       .release = single_release,
1033 +};
1034 +
1035 +static int proc_get_write_reg_open(struct inode *inode, struct file *file){
1036 +        return single_open(file, proc_get_write_reg, PDE_DATA(inode));
1037 +}
1038 +
1039 +static const struct file_operations proc_get_write_reg_fops = {
1040 +        .owner = THIS_MODULE,
1041 +       .open = proc_get_write_reg_open,
1042 +        .read = seq_read,
1043 +        .llseek = seq_lseek,
1044 +       .write = proc_set_write_reg,
1045 +       .release = seq_release,
1046 +};
1047 +
1048 +static int proc_get_read_reg_open(struct inode *inode, struct file *file){
1049 +        return single_open(file, proc_get_read_reg, PDE_DATA(inode));
1050 +}
1051 +
1052 +static const struct file_operations proc_get_read_reg_fops = {
1053 +        .owner = THIS_MODULE,
1054 +       .open = proc_get_read_reg_open,
1055 +        .read = seq_read,
1056 +        .llseek = seq_lseek,
1057 +       .write = proc_set_read_reg,
1058 +       .release = seq_release,
1059 +};
1060 +
1061 +static int proc_get_rssi_disp_open(struct inode *inode, struct file *file){
1062 +        return single_open(file, proc_get_rssi_disp, PDE_DATA(inode));
1063 +}
1064 +
1065 +static const struct file_operations proc_get_rssi_disp_fops = {
1066 +        .owner = THIS_MODULE,
1067 +       .open = proc_get_rssi_disp_open,
1068 +        .read = seq_read,
1069 +        .llseek = seq_lseek,
1070 +       .write = proc_set_rssi_disp,
1071 +       .release = seq_release,
1072 +};
1073 +
1074 +static int proc_get_ampdu_enable_open(struct inode *inode, struct file *file){
1075 +        return single_open(file, proc_get_ampdu_enable, PDE_DATA(inode));
1076 +}
1077 +
1078 +static const struct file_operations proc_get_ampdu_enable_fops = {
1079 +        .owner = THIS_MODULE,
1080 +       .open = proc_get_ampdu_enable_open,
1081 +        .read = seq_read,
1082 +        .llseek = seq_lseek,
1083 +       .write = proc_set_ampdu_enable,
1084 +       .release = seq_release,
1085 +};
1086 +
1087 +static int proc_get_rx_signal_open(struct inode *inode, struct file *file){
1088 +        return single_open(file, proc_get_rx_signal, PDE_DATA(inode));
1089 +}
1090 +
1091 +static const struct file_operations proc_get_rx_signal_fops = {
1092 +        .owner = THIS_MODULE,
1093 +       .open = proc_get_rx_signal_open,
1094 +        .read = seq_read,
1095 +        .llseek = seq_lseek,
1096 +       .write = proc_set_rx_signal,
1097 +       .release = seq_release,
1098 +};
1099 +
1100 +static int proc_get_fwstate_open(struct inode *inode, struct file *file){
1101 +        return single_open(file, proc_get_fwstate, PDE_DATA(inode));
1102 +}
1103 +
1104 +static const struct file_operations proc_get_fwstate_fops = {
1105 +        .owner = THIS_MODULE,
1106 +       .open = proc_get_fwstate_open,
1107 +        .read = seq_read,
1108 +        .llseek = seq_lseek,
1109 +       .release = single_release,
1110 +};
1111 +
1112 +static int proc_get_mlmext_state_open(struct inode *inode, struct file *file){
1113 +        return single_open(file, proc_get_mlmext_state, PDE_DATA(inode));
1114 +}
1115 +
1116 +static const struct file_operations proc_get_mlmext_state_fops = {
1117 +        .owner = THIS_MODULE,
1118 +       .open = proc_get_mlmext_state_open,
1119 +        .read = seq_read,
1120 +        .llseek = seq_lseek,
1121 +       .release = single_release,
1122 +};
1123 +
1124 +static int proc_get_qos_option_open(struct inode *inode, struct file *file){
1125 +        return single_open(file, proc_get_qos_option, PDE_DATA(inode));
1126 +}
1127 +
1128 +static const struct file_operations proc_get_qos_option_fops = {
1129 +        .owner = THIS_MODULE,
1130 +       .open = proc_get_qos_option_open,
1131 +        .read = seq_read,
1132 +        .llseek = seq_lseek,
1133 +       .release = single_release,
1134 +};
1135 +
1136 +static int proc_get_ht_option_open(struct inode *inode, struct file *file){
1137 +        return single_open(file, proc_get_ht_option, PDE_DATA(inode));
1138 +}
1139 +
1140 +static const struct file_operations proc_get_ht_option_fops = {
1141 +        .owner = THIS_MODULE,
1142 +       .open = proc_get_ht_option_open,
1143 +        .read = seq_read,
1144 +        .llseek = seq_lseek,
1145 +       .release = single_release,
1146 +};
1147 +
1148 +static int proc_get_rf_info_open(struct inode *inode, struct file *file){
1149 +        return single_open(file, proc_get_rf_info, PDE_DATA(inode));
1150 +}
1151 +
1152 +static const struct file_operations proc_get_rf_info_fops = {
1153 +        .owner = THIS_MODULE,
1154 +       .open = proc_get_rf_info_open,
1155 +        .read = seq_read,
1156 +        .llseek = seq_lseek,
1157 +       .release = single_release,
1158 +};
1159 +
1160 +static int proc_get_ap_info_open(struct inode *inode, struct file *file){
1161 +        return single_open(file, proc_get_ap_info, PDE_DATA(inode));
1162 +}
1163 +
1164 +static const struct file_operations proc_get_ap_info_fops = {
1165 +        .owner = THIS_MODULE,
1166 +       .open = proc_get_ap_info_open,
1167 +        .read = seq_read,
1168 +        .llseek = seq_lseek,
1169 +       .release = single_release,
1170 +};
1171 +
1172 +static int proc_get_adapter_state_open(struct inode *inode, struct file *file){
1173 +        return single_open(file, proc_get_adapter_state, PDE_DATA(inode));
1174 +}
1175 +
1176 +static const struct file_operations proc_get_adapter_state_fops = {
1177 +        .owner = THIS_MODULE,
1178 +       .open = proc_get_adapter_state_open,
1179 +        .read = seq_read,
1180 +        .llseek = seq_lseek,
1181 +       .release = single_release,
1182 +};
1183 +
1184 +static int proc_get_trx_info_open(struct inode *inode, struct file *file){
1185 +        return single_open(file, proc_get_trx_info, PDE_DATA(inode));
1186 +}
1187 +
1188 +static const struct file_operations proc_get_trx_info_fops = {
1189 +        .owner = THIS_MODULE,
1190 +       .open = proc_get_trx_info_open,
1191 +        .read = seq_read,
1192 +        .llseek = seq_lseek,
1193 +       .release = single_release,
1194 +};
1195 +
1196 +static int proc_get_sec_info_open(struct inode *inode, struct file *file){
1197 +        return single_open(file, proc_get_sec_info, PDE_DATA(inode));
1198 +}
1199 +
1200 +static const struct file_operations proc_get_sec_info_fops = {
1201 +        .owner = THIS_MODULE,
1202 +       .open = proc_get_sec_info_open,
1203 +        .read = seq_read,
1204 +        .llseek = seq_lseek,
1205 +       .release = single_release,
1206 +};
1207 +
1208 +# ifdef CONFIG_AP_MODE
1209 +
1210 +static int proc_get_all_sta_info_open(struct inode *inode, struct file *file){
1211 +        return single_open(file, proc_get_all_sta_info, PDE_DATA(inode));
1212 +}
1213 +
1214 +static const struct file_operations proc_get_all_sta_info_fops = {
1215 +        .owner = THIS_MODULE,
1216 +       .open = proc_get_all_sta_info_open,
1217 +        .read = seq_read,
1218 +        .llseek = seq_lseek,
1219 +       .release = single_release,
1220 +};
1221 +
1222 +# endif
1223 +
1224 +# ifdef DBG_MEMORY_LEAK
1225 +
1226 +static int proc_get_malloc_cnt_open(struct inode *inode, struct file *file){
1227 +        return single_open(file, proc_get_malloc_cnt, PDE_DATA(inode));
1228 +}
1229 +
1230 +static const struct file_operations proc_get_malloc_cnt_fops = {
1231 +        .owner = THIS_MODULE,
1232 +       .open = proc_get_malloc_cnt_open,
1233 +        .read = seq_read,
1234 +        .llseek = seq_lseek,
1235 +       .release = single_release,
1236 +};
1237 +
1238 +# endif
1239 +
1240 +# ifdef CONFIG_FIND_BEST_CHANNEL
1241 +
1242 +static int proc_get_best_channel_open(struct inode *inode, struct file *file){
1243 +        return single_open(file, proc_get_best_channel, PDE_DATA(inode));
1244 +}
1245 +
1246 +static const struct file_operations proc_get_best_channel_fops = {
1247 +        .owner = THIS_MODULE,
1248 +       .open = proc_get_best_channel_open,
1249 +        .read = seq_read,
1250 +        .llseek = seq_lseek,
1251 +       .release = single_release,
1252 +};
1253 +
1254 +# endif
1255 +
1256 +#endif
1257 +
1258  void rtw_proc_init_one(struct net_device *dev)
1259  {
1260         struct proc_dir_entry *dir_dev = NULL;
1261 @@ -275,28 +515,37 @@ void rtw_proc_init_one(struct net_device *dev)
1262  #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
1263                 rtw_proc=create_proc_entry(rtw_proc_name, S_IFDIR, proc_net);
1264  #else
1265 +# if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1266                 rtw_proc=create_proc_entry(rtw_proc_name, S_IFDIR, init_net.proc_net);
1267 +# else
1268 +               rtw_proc=proc_mkdir(rtw_proc_name, init_net.proc_net);
1269 +# endif
1270  #endif
1271                 if (rtw_proc == NULL) {
1272                         DBG_8192C(KERN_ERR "Unable to create rtw_proc directory\n");
1273                         return;
1274                 }
1275  
1276 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1277                 entry = create_proc_read_entry("ver_info", S_IFREG | S_IRUGO, rtw_proc, proc_get_drv_version, dev);                                
1278 +#else
1279 +               entry = proc_create_data("ver_info", S_IFREG | S_IRUGO, rtw_proc, &proc_get_drv_version_fops, dev);                                
1280 +#endif
1281                 if (!entry) {
1282                         DBG_871X("Unable to create_proc_read_entry!\n"); 
1283                         return;
1284                 }
1285         }
1286  
1287 -       
1288 -
1289         if(padapter->dir_dev == NULL)
1290         {
1291 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1292                 padapter->dir_dev = create_proc_entry(dev->name, 
1293                                           S_IFDIR | S_IRUGO | S_IXUGO, 
1294                                           rtw_proc);
1295 -
1296 +#else
1297 +               padapter->dir_dev = proc_mkdir(dev->name,rtw_proc);
1298 +#endif
1299                 dir_dev = padapter->dir_dev;
1300  
1301                 if(dir_dev==NULL)
1302 @@ -324,84 +573,127 @@ void rtw_proc_init_one(struct net_device *dev)
1303  
1304         rtw_proc_cnt++;
1305  
1306 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1307         entry = create_proc_read_entry("write_reg", S_IFREG | S_IRUGO,
1308                                    dir_dev, proc_get_write_reg, dev);                              
1309 +#else
1310 +       entry = proc_create_data("write_reg", S_IFREG | S_IRUGO,
1311 +                                  dir_dev, &proc_get_write_reg_fops, dev);                                
1312 +#endif
1313         if (!entry) {
1314                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1315                 return;
1316         }
1317 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1318         entry->write_proc = proc_set_write_reg;
1319  
1320         entry = create_proc_read_entry("read_reg", S_IFREG | S_IRUGO,
1321                                    dir_dev, proc_get_read_reg, dev);                               
1322 +#else
1323 +       entry = proc_create_data("read_reg", S_IFREG | S_IRUGO,
1324 +                                  dir_dev, &proc_get_read_reg_fops, dev);                                 
1325 +#endif
1326         if (!entry) {
1327                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1328                 return;
1329         }
1330 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1331         entry->write_proc = proc_set_read_reg;
1332  
1333 -       
1334         entry = create_proc_read_entry("fwstate", S_IFREG | S_IRUGO,
1335                                    dir_dev, proc_get_fwstate, dev);                                
1336 +#else
1337 +       entry = proc_create_data("fwstate", S_IFREG | S_IRUGO,
1338 +                                  dir_dev, &proc_get_fwstate_fops, dev);                                  
1339 +#endif
1340         if (!entry) {
1341                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1342                 return;
1343         }
1344 -
1345 -
1346 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1347         entry = create_proc_read_entry("sec_info", S_IFREG | S_IRUGO,
1348                                    dir_dev, proc_get_sec_info, dev);                               
1349 +#else
1350 +       entry = proc_create_data("sec_info", S_IFREG | S_IRUGO,
1351 +                                  dir_dev, &proc_get_sec_info_fops, dev);                                 
1352 +#endif
1353         if (!entry) {
1354                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1355                 return;
1356         }
1357 -
1358 -
1359 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1360         entry = create_proc_read_entry("mlmext_state", S_IFREG | S_IRUGO,
1361                                    dir_dev, proc_get_mlmext_state, dev);                                   
1362 +#else
1363 +       entry = proc_create_data("mlmext_state", S_IFREG | S_IRUGO,
1364 +                                  dir_dev, &proc_get_mlmext_state_fops, dev);                             
1365 +#endif
1366         if (!entry) {
1367                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1368                 return;
1369         }
1370 -
1371 -
1372 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1373         entry = create_proc_read_entry("qos_option", S_IFREG | S_IRUGO,
1374                                    dir_dev, proc_get_qos_option, dev);                             
1375 +#else
1376 +       entry = proc_create_data("qos_option", S_IFREG | S_IRUGO,
1377 +                                  dir_dev, &proc_get_qos_option_fops, dev);                               
1378 +#endif
1379         if (!entry) {
1380                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1381                 return;
1382         }
1383 -
1384 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1385         entry = create_proc_read_entry("ht_option", S_IFREG | S_IRUGO,
1386                                    dir_dev, proc_get_ht_option, dev);                              
1387 +#else
1388 +       entry = proc_create_data("ht_option", S_IFREG | S_IRUGO,
1389 +                                  dir_dev, &proc_get_ht_option_fops, dev);                                
1390 +#endif
1391         if (!entry) {
1392                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1393                 return;
1394         }
1395 -
1396 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1397         entry = create_proc_read_entry("rf_info", S_IFREG | S_IRUGO,
1398                                    dir_dev, proc_get_rf_info, dev);                                
1399 +#else
1400 +       entry = proc_create_data("rf_info", S_IFREG | S_IRUGO,
1401 +                                  dir_dev, &proc_get_rf_info_fops, dev);                                  
1402 +#endif
1403         if (!entry) {
1404                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1405                 return;
1406         }
1407 -       
1408 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1409         entry = create_proc_read_entry("ap_info", S_IFREG | S_IRUGO,
1410                                    dir_dev, proc_get_ap_info, dev);                                
1411 +#else
1412 +       entry = proc_create_data("ap_info", S_IFREG | S_IRUGO,
1413 +                                  dir_dev, &proc_get_ap_info_fops, dev);                                  
1414 +#endif
1415         if (!entry) {
1416                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1417                 return;
1418         }
1419 -
1420 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1421         entry = create_proc_read_entry("adapter_state", S_IFREG | S_IRUGO,
1422                                    dir_dev, proc_get_adapter_state, dev);                                  
1423 +#else
1424 +       entry = proc_create_data("adapter_state", S_IFREG | S_IRUGO,
1425 +                                  dir_dev, &proc_get_adapter_state_fops, dev);                            
1426 +#endif
1427         if (!entry) {
1428                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1429                 return;
1430         }
1431 -
1432 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1433         entry = create_proc_read_entry("trx_info", S_IFREG | S_IRUGO,
1434                                    dir_dev, proc_get_trx_info, dev);                               
1435 +#else
1436 +       entry = proc_create_data("trx_info", S_IFREG | S_IRUGO,
1437 +                                  dir_dev, &proc_get_trx_info_fops, dev);                                 
1438 +#endif
1439         if (!entry) {
1440                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1441                 return;
1442 @@ -409,56 +701,93 @@ void rtw_proc_init_one(struct net_device *dev)
1443  
1444  #ifdef CONFIG_AP_MODE
1445  
1446 +# if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1447         entry = create_proc_read_entry("all_sta_info", S_IFREG | S_IRUGO,
1448                                    dir_dev, proc_get_all_sta_info, dev);                                   
1449 +# else
1450 +       entry = proc_create_data("all_sta_info", S_IFREG | S_IRUGO,
1451 +                                  dir_dev, &proc_get_all_sta_info_fops, dev);                             
1452 +# endif
1453         if (!entry) {
1454                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1455                 return;
1456         }
1457 +
1458  #endif
1459  
1460  #ifdef DBG_MEMORY_LEAK
1461 +
1462 +# if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1463         entry = create_proc_read_entry("_malloc_cnt", S_IFREG | S_IRUGO,
1464                                    dir_dev, proc_get_malloc_cnt, dev);                             
1465 +# else
1466 +       entry = proc_create_data("_malloc_cnt", S_IFREG | S_IRUGO,
1467 +                                  dir_dev, &proc_get_malloc_cnt_fops, dev);                               
1468 +# endif
1469         if (!entry) {
1470                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1471                 return;
1472         }
1473 +
1474  #endif
1475  
1476  #ifdef CONFIG_FIND_BEST_CHANNEL
1477 +
1478 +# if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1479         entry = create_proc_read_entry("best_channel", S_IFREG | S_IRUGO,
1480                                    dir_dev, proc_get_best_channel, dev);                                   
1481 +# else
1482 +       entry = proc_create_data("best_channel", S_IFREG | S_IRUGO,
1483 +                                  dir_dev, &proc_get_best_channel_fops, dev);                             
1484 +# endif
1485         if (!entry) {
1486                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1487                 return;
1488         }
1489 +
1490  #endif
1491  
1492 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1493         entry = create_proc_read_entry("rx_signal", S_IFREG | S_IRUGO,
1494                                    dir_dev, proc_get_rx_signal, dev);                              
1495 +#else
1496 +       entry = proc_create_data("rx_signal", S_IFREG | S_IRUGO,
1497 +                                  dir_dev, &proc_get_rx_signal_fops, dev);                                
1498 +#endif
1499         if (!entry) {
1500                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1501                 return;
1502         }
1503 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1504         entry->write_proc = proc_set_rx_signal;
1505  
1506         entry = create_proc_read_entry("ampdu_enable", S_IFREG | S_IRUGO,
1507                                    dir_dev, proc_get_ampdu_enable, dev);                                   
1508 +#else
1509 +       entry = proc_create_data("ampdu_enable", S_IFREG | S_IRUGO,
1510 +                                  dir_dev, &proc_get_ampdu_enable_fops, dev);                             
1511 +#endif
1512         if (!entry) {
1513                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1514                 return;
1515         }
1516 +
1517 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1518         entry->write_proc = proc_set_ampdu_enable;
1519  
1520         entry = create_proc_read_entry("rssi_disp", S_IFREG | S_IRUGO,
1521                                    dir_dev, proc_get_rssi_disp, dev);                              
1522 +#else
1523 +       entry = proc_create_data("rssi_disp", S_IFREG | S_IRUGO,
1524 +                                  dir_dev, &proc_get_rssi_disp_fops, dev);                                
1525 +#endif
1526         if (!entry) {
1527                 DBG_871X("Unable to create_proc_read_entry!\n"); 
1528                 return;
1529         }
1530 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1531         entry->write_proc = proc_set_rssi_disp;
1532 -
1533 +#endif
1534  }
1535  
1536  void rtw_proc_remove_one(struct net_device *dev)
1537 @@ -797,27 +1126,22 @@ u32 rtw_start_drv_threads(_adapter *padapter)
1538         RT_TRACE(_module_os_intfs_c_,_drv_info_,("+rtw_start_drv_threads\n"));
1539  
1540  #ifdef CONFIG_SDIO_HCI
1541 -       padapter->xmitThread = kernel_thread(rtw_xmit_thread, padapter, CLONE_FS|CLONE_FILES);
1542 -       if(padapter->xmitThread < 0)
1543 +       if(!start_kthread(&padapter->xmitThread, rtw_xmit_thread, padapter, "8192cu-xmit"))
1544                 _status = _FAIL;
1545  #endif
1546  
1547  #ifdef CONFIG_RECV_THREAD_MODE
1548 -       padapter->recvThread = kernel_thread(recv_thread, padapter, CLONE_FS|CLONE_FILES);
1549 -       if(padapter->recvThread < 0)
1550 +       if(!start_kthread(&padapter->recvThread, recv_thread, padapter, "8192cu-recv"))
1551                 _status = _FAIL;        
1552  #endif
1553  
1554 -       padapter->cmdThread = kernel_thread(rtw_cmd_thread, padapter, CLONE_FS|CLONE_FILES);
1555 -       if(padapter->cmdThread < 0)
1556 +       if(!start_kthread(&padapter->cmdThread, rtw_cmd_thread, padapter, "8192cu-cmd"))
1557                 _status = _FAIL;
1558         else
1559                 _rtw_down_sema(&padapter->cmdpriv.terminate_cmdthread_sema); //wait for cmd_thread to run
1560 -               
1561  
1562  #ifdef CONFIG_EVENT_THREAD_MODE
1563 -       padapter->evtThread = kernel_thread(event_thread, padapter, CLONE_FS|CLONE_FILES);
1564 -       if(padapter->evtThread < 0)
1565 +       if(!start_kthread(&padapter->evtThread, event_thread, padapter, "8192cu-evt"))
1566                 _status = _FAIL;                
1567  #endif
1568  
1569 diff --git a/os_dep/linux/usb_intf.c b/os_dep/linux/usb_intf.c
1570 index 134acdc..f9a01e9 100644
1571 --- a/os_dep/linux/usb_intf.c
1572 +++ b/os_dep/linux/usb_intf.c
1573 @@ -99,7 +99,9 @@ static struct usb_device_id rtw_usb_id_tbl[] ={
1574         {USB_DEVICE(0x2019, 0xED17)},//PCI - Edimax
1575         {USB_DEVICE(0x0DF6, 0x0052)},//Sitecom - Edimax
1576         {USB_DEVICE(0x7392, 0x7811)},//Edimax - Edimax
1577 +       {USB_DEVICE(0x07B8, 0x8188)},//Abocom - Abocom
1578         {USB_DEVICE(0x07B8, 0x8189)},//Abocom - Abocom
1579 +       {USB_DEVICE(0x0846, 0x9041)},//NetGear WNA1000M
1580         {USB_DEVICE(0x0EB0, 0x9071)},//NO Brand - Etop
1581         {USB_DEVICE(0x06F8, 0xE033)},//Hercules - Edimax
1582         {USB_DEVICE(0x103C, 0x1629)},//HP - Lite-On ,8188CUS Slim Combo
1583 @@ -137,6 +139,7 @@ static struct usb_device_id rtw_usb_id_tbl[] ={
1584         {USB_DEVICE(0x2001, 0x3307)},//D-Link - Cameo
1585         {USB_DEVICE(0x2001, 0x330A)},//D-Link - Alpha
1586         {USB_DEVICE(0x2001, 0x3309)},//D-Link - Alpha
1587 +       {USB_DEVICE(0x2001, 0x330D)},//D-Link - Alpha(?)
1588         {USB_DEVICE(0x0586, 0x341F)},//Zyxel - Abocom
1589         {USB_DEVICE(0x7392, 0x7822)},//Edimax - Edimax
1590         {USB_DEVICE(0x2019, 0xAB2B)},//Planex - Abocom
1591 diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c
1592 index 04cb35f..343cd82 100644
1593 --- a/os_dep/osdep_service.c
1594 +++ b/os_dep/osdep_service.c
1595 @@ -1553,3 +1553,19 @@ u64 rtw_division64(u64 x, u64 y)
1596  #endif
1597  }
1598  
1599 +#ifdef PLATFORM_LINUX
1600 +int start_kthread(_thread_hdl_ *t_hdl, int (*threadfn)(void *data),
1601 +                 void *data, const char *name)
1602 +{
1603 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
1604 +       *t_hdl = kernel_thread(threadfn, data, CLONE_FS|CLONE_FILES);
1605 +       if(*t_hdl < 0)
1606 +#else
1607 +       *t_hdl = kthread_run(threadfn, data, name);
1608 +       if(IS_ERR(*t_hdl))
1609 +#endif
1610 +               return 0;
1611 +       return -1;
1612 +}
1613 +#endif
1614 +