usb网卡驱动的编译以及安装

软件和网站开发以及相关技术探讨
回复
sarrow
帖子: 403
注册时间: 2007-10-27 1:04

usb网卡驱动的编译以及安装

#1

帖子 sarrow » 2013-10-10 9:18

新买了一个usb3.0的usb网卡;

是 UNITEK 的 Y-3045 型号。

按他们官方的描述,他们使用的是 AXIX 的usb网卡芯片。但是,我在驱动的编译以及安装上遇到了困难。

这是.c文件开头部分:

/*
* ASIX AX88179 based USB 3.0 Ethernet Devices
* Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
* Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net>
* Copyright (c) 2002-2003 TiVo Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

/* debug messages, extra info */
/* #define DEBUG */

#include <linux/version.h>
/*#include <linux/config.h>*/
#ifdef CONFIG_USB_DEBUG
#define DEBUG
#endif
#include <linux/module.h>
#include <linux/kmod.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/workqueue.h>
#include <linux/mii.h>
#include <linux/usb.h>
#include <linux/crc32.h>
#include <linux/if_vlan.h>

....
我发现,自己没有 <linux/usb.h> 竟然也能通过编译!

编译完后,执行 sudo insmod ax88179_178a.ko 提示:Error: could not insert module ax88179_178a.ko: Unknown symbol in module
这是 axix 提供的驱动程式:
http://www.asix.com.tw/FrootAttach/driv ... CE.tar.bz2
sarrow
帖子: 403
注册时间: 2007-10-27 1:04

Re: usb网卡驱动的编译以及安装

#2

帖子 sarrow » 2013-10-10 9:27

另外,dmesg | tail 显示:

[62799.801752] ax88179_178a: Unknown symbol usbnet_suspend (err 0)
[62799.801768] ax88179_178a: Unknown symbol usbnet_start_xmit (err 0)
[62799.801785] ax88179_178a: Unknown symbol usbnet_read_cmd_nopm (err 0)
[62799.801803] ax88179_178a: Unknown symbol usbnet_get_drvinfo (err 0)
[62799.801819] ax88179_178a: Unknown symbol usbnet_get_endpoints (err 0)
[62799.801845] ax88179_178a: Unknown symbol usbnet_stop (err 0)
[62799.801866] ax88179_178a: Unknown symbol usbnet_defer_kevent (err 0)
[62799.801885] ax88179_178a: Unknown symbol usbnet_disconnect (err 0)
[62799.801901] ax88179_178a: Unknown symbol usbnet_probe (err 0)
[62799.801918] ax88179_178a: Unknown symbol usbnet_resume (err 0)

备注:我用的是13.04,除了安装基本的开发程序外,没有做什么修改。

找到的参考文章:
https://www.olimex.com/forum/index.php?topic=103.0
http://ubuntuforums.org/showthread.php?t=1360950

内核设置的问题?
sarrow
帖子: 403
注册时间: 2007-10-27 1:04

Re: usb网卡驱动的编译以及安装

#3

帖子 sarrow » 2013-10-11 6:49

问题半解决:

sudo insmod /lib/modules/3.8.0-27-generic/kernel/drivers/net/usb/usbnet.ko
sudo insmod ax88179_178a.ko

之后,成功使用该usb网卡。

参考自:

http://xpenology.com/forum/viewtopic.php?f=2&t=928

我不明白:

1. 为什么 usbnet.ko 没有开机就加载?是系统自动优化了么?
2. 我locate 到了两个版本的 usbnet.ko;同名、不同版本的ko,不能同时insmod吧?有冲突产生,如何解决?
3. 还有,这些modules 如何卸载?

感觉坛子真冷清;ubuntu不会,就这样慢慢死掉吧?——在中国
回复