ZTE ZXDSL v2 driver update for Linux Kernel 2.6.31 – 2.6.35 x86
2 grudnia 2009 at 20:57 18 Komentarzy
This is patch for ZTE ZXDSL 852 v2 ADSL modem USB Driver. Driver version: USB-ADL-7-2.0-0.2.0.11.
Requirements (Ubuntu)
Package build-essential is required.
Run
# sudo apt-cdrom add
from command line (terminal) if you are offline. This require installation CD-ROM inserted into drive.
Installation
# sudo apt-get install build-essential
Howto
mkdir unicorn cd unicorn wget http://linnet.cba.pl/attachment.php?aid=5 -O zxdsl852.tar.gz tar zxvf zxdsl852.tar.gz wget http://mariuszs.googlepages.com/zxdslv2-2.6.31.diff -O zxdslv2-2.6.31.diff patch src/unicorn_ethdrv.c < zxdslv2-2.6.31.diff make sudo make install
Explanation
- The priv field has been removed from struct net_device; drivers should use netdev_priv() instead.
- The owner field of struct proc_dir_entry has been removed, causing lots of changes throughout the tree.
- Most of the callback functions/methods associated with the net_device structure have been moved out of that structure and into the new struct net_device_ops. In-tree drivers have been converted to the new API.
Code
cat zxdslv2-2.6.31.diff
--- ../oryg/src/unicorn_ethdrv.c 2008-10-02 14:10:27.000000000 +0200 +++ src/unicorn_ethdrv.c 2009-11-30 19:20:37.733581549 +0100 @@ -3,6 +3,9 @@ The chipset consists of the ADSL DMT transceiver ST70138 and the ST20174 Analog Front End (AFE). This file contains the ethernet interface and SAR routines. + + Updated to work with Linux kernel >= 2.6.31 by + Mariusz Smykuła 2009-11-30 */ #include #include @@ -961,7 +964,7 @@ static int unicorn_eth_send(struct sk_buff *skb, struct net_device *eth_dev) { - struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *) eth_dev->priv; + struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *) netdev_priv(eth_dev); struct atm_ext_skb_data *skb_data; int status; @@ -1082,7 +1085,7 @@ static int unicorn_eth_open(struct net_device *eth_dev) { - struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)eth_dev->priv; + struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)netdev_priv(eth_dev); DBG(ATM_D,"vpi=%d,vci=%d\n",drv->vpi,drv->vci); @@ -1100,12 +1103,12 @@ // Install the proc_read function in /proc/net/atm/ #ifndef CONFIG_ATM atm_proc_root = proc_mkdir("net/atm",NULL); - if (atm_proc_root) atm_proc_root->owner=THIS_MODULE; + //if (atm_proc_root) atm_proc_root->owner=THIS_MODULE; #endif if (atm_proc_root) { drv->proc_dir_entry = create_proc_read_entry("UNICORN:0",0,atm_proc_root,unicorn_eth_proc_read,drv); if (drv->proc_dir_entry) { - drv->proc_dir_entry->owner = THIS_MODULE; + //drv->proc_dir_entry->owner = THIS_MODULE; } else { DBG(ATM_D,"no proc entry installed\n"); } @@ -1126,7 +1129,7 @@ static int unicorn_eth_close(struct net_device *eth_dev) { - struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)eth_dev->priv; + struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)netdev_priv(eth_dev); DBG(ATM_D,"\n"); @@ -1153,7 +1156,7 @@ static struct net_device_stats *unicorn_eth_stats(struct net_device *eth_dev) { - struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)eth_dev->priv; + struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)netdev_priv(eth_dev); return &drv->eth_stats; } @@ -1305,7 +1308,7 @@ static int unicorn_eth_ioctl(struct net_device *eth_dev, struct ifreq *rq, int cmd) { - struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)eth_dev->priv; + struct unicorn_ethdrv *drv = (struct unicorn_ethdrv *)netdev_priv(eth_dev); T_MswCtrl ctrl; void *user_buffer; int err = -ENOTTY; @@ -1376,6 +1379,18 @@ #endif #endif + +static const struct net_device_ops unicorn_netdev_ops = { + .ndo_open = unicorn_eth_open, + .ndo_stop = unicorn_eth_close, + .ndo_do_ioctl = unicorn_eth_ioctl, + .ndo_change_mtu = unicorn_eth_change_mtu, + .ndo_start_xmit = unicorn_eth_send, + .ndo_get_stats = unicorn_eth_stats, + .ndo_set_multicast_list = unicorn_eth_set_multicast, + .ndo_tx_timeout = unicorn_eth_tx_timeout +}; + int unicorn_eth_init(void) { struct net_device *eth_dev; @@ -1391,11 +1406,11 @@ } eth_dev = alloc_etherdev(sizeof(struct unicorn_ethdrv)); - if (!eth_dev || !eth_dev->priv) { + if (!eth_dev || !netdev_priv(eth_dev)) { DBG(ATM_D,"no memory for drv data\n"); return -ENOMEM; } - unicorn_ethdrv = drv = eth_dev->priv; + unicorn_ethdrv = drv = netdev_priv(eth_dev); memset(drv, 0, sizeof(struct unicorn_ethdrv)); #if (LINUX_VERSION_CODE open = unicorn_eth_open; - eth_dev->stop = unicorn_eth_close; - eth_dev->do_ioctl = unicorn_eth_ioctl; - eth_dev->change_mtu = unicorn_eth_change_mtu; - eth_dev->hard_start_xmit = unicorn_eth_send; - eth_dev->get_stats = unicorn_eth_stats; - eth_dev->set_multicast_list = unicorn_eth_set_multicast; - eth_dev->tx_timeout = unicorn_eth_tx_timeout; + eth_dev->netdev_ops = &unicorn_netdev_ops; + eth_dev->watchdog_timeo = HZ*5; return 0;
Results
# modinfo unicorn_usb_eth filename: /lib/modules/2.6.31-15-generic/extra/unicorn_usb_eth.ko license: GPL description: ATM driver for the ST UNICORN II ADSL modem. author: ashutosh.sharma@st.com alias: usb:v0483p0138d*dc*dsc*dp*ic*isc*ip* depends: vermagic: 2.6.31-15-generic SMP mod_unload modversions 586 parm: if_name:charp parm: mac_address:charp parm: VPI:int parm: VCI:int parm: PROTOCOL:charp parm: ENCAPS:charp parm: ActivationMode:long parm: AlternativeSetting:long parm: AutoActivation:long parm: DownstreamRate:long parm: LoopbackMode:long parm: MswDebugLevel:long parm: RetryTime:long parm: DebugLevel:long parm: ledScenario:long
Source
Download: zxdslv2-2.6.31.diff
References
API changes in the 2.6 kernel series
Entry filed under: Uncategorized. Tags: zxdsl unicorn driver linux 2.6.31.
18 Komentarzy Add your own
Dodaj komentarz
Trackback this post | Subscribe to the comments via RSS Feed
1. Bartek | 2 lutego 2010 o 23:30
i used it and it really works. thx a lot!
2. fiddlesticker | 3 lutego 2010 o 7:36
Thanks, I have never chance to test it 😉 I dont have modem 😀
3. joannes | 25 lutego 2010 o 17:42
Hay i try it but its not working do i need internet connection while im doing the patch
4. fiddlesticker | 25 lutego 2010 o 17:59
Look at this for OFFLINE installation…
5. Marcin1980 | 13 kwietnia 2010 o 9:28
Hi, I installed ubu 9.1 system and driver with patch as you wrote here and ududsl was working fine but afer last automatic online update (12.04.2010) my modem does not even want to synchronize.
I tried to reinstall all driver with patch but unfortunately this does not work. Any ideas ?
Thanks in advance.
6. joannes | 5 Maj 2010 o 8:43
Will it work for ubuntu 10.04?
7. spc | 28 czerwca 2010 o 17:28
Sorry mate bu this is not working
slackware 13.1
2.6.33.4 gcc 4.4.4
make
make -C /lib/modules/2.6.33.4-smp/build M=/home/specnaz/extra/slacknet/zxdslv2
make[1]: Entering directory `/usr/src/linux-2.6.33.4′
LD /home/specnaz/extra/slacknet/zxdslv2/built-in.o
CC [M] /home/specnaz/extra/slacknet/zxdslv2/src/unicorn_usbdrv.o
/home/specnaz/extra/slacknet/zxdslv2/src/unicorn_usbdrv.c:7:28: error: linux/autoconf.h: No such file or directory
/home/specnaz/extra/slacknet/zxdslv2/src/unicorn_usbdrv.c:275: warning: ‚TNumberOfCarrier’ initialized and declared ‚extern’
make[2]: *** [/home/specnaz/extra/slacknet/zxdslv2/src/unicorn_usbdrv.o] Error 1
make[1]: *** [_module_/home/specnaz/extra/slacknet/zxdslv2] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.33.4′
make: *** [all] Error 2
8. spc | 8 lipca 2010 o 13:39
OK Patch works with 2.6.33.4 kernel
9. fiddlesticker | 8 lipca 2010 o 19:51
Thanks for this info 🙂
10. spc | 28 października 2010 o 21:45
Well in case somebody was wondering: patch works well with 2.6.35.4…
11. fiddlesticker | 29 października 2010 o 6:18
Thanks for info.
12. Gand | 9 lutego 2011 o 10:16
The driver doesn’t work with kernel 2.6.37
13. spc | 11 marca 2011 o 15:52
Unfortunately, I can confirm this, with 2.6.37.3.
Can’t compile the driver.
14. spc | 11 marca 2011 o 15:58
Nope, I doesn’t work with 2.6.37.3. 😦
15. spc | 11 marca 2011 o 16:03
Nope, It doesn’t work with 2.6.37.3
16. fiddlesticker | 11 marca 2011 o 16:37
Ok, I need to look at this 😉 What distribution are you using?
17. Evilus | 31 marca 2011 o 15:14
Yep, but this is no mean, because I using Unicorn II-based ADSL modem (ZTE ZXDSL 852 v2) on Slackware, but it works on any distribution (tested on Debian and RedHat aka Fedora).
Kernel actually I’m using: 2.6.33.4
Kernel where ADSL modem didn’t work: 2.6.38.2
But if it isn’t possible to run Unicorn II on 2.6.38 kernel, I’ll buy ADSL router.
18. fiddlesticker | 31 marca 2011 o 22:47
New patch for 2.6.38 (test version)
http://mariuszs.googlepages.com/zxdslv2-2.6.38.patch
Using (from unicorn directory):
patch -p1 < zxdslv2-2.6.38.patch