让E6的usblan自动启用

好久没有心得了..

之前E6都用的是samba旧版在usblan下传数据,但是在Linux下有很纠结的编码问题..最近E6装上了ftp服务端,可以直接ftp上传给E6数据了,方便了许多..

可是E6插上的时候usblan的usb0网卡不会自动启动的..就琢磨着让E6插上的时候自动让机器启动usblan..这个思路很清晰..

那就是动用udev..翻出以前没有翻译完的   Writing udev rules ,看了语法之后便开始动手..使vim新建了/etc/udev/rules.d/13-usb-lan.rules文件.

匹配KERNEL==”usb0″,然后RUN+=”ifconfig usb0 192.168.1.13″ 成功..

可是怎么没有在ifconfig里看到呢..郁闷..去研究了下人家原文里的RUN示例..发现似乎要用上绝对路径..

KERNEL==”usb0″, RUN+=”ifconfig usb0 192.168.1.13″

改成了

KERNEL==”usb0″, RUN+=”/sbin/ifconfig usb0 192.168.1.13″

这样就好了..拔掉E6再插上..执行ifconfig..

usb0      Link encap:Ethernet  HWaddr 32:69:F5:10:82:3B
inet addr:192.168.1.13  Bcast:192.168.1.255  Mask:255.255.255.0
inet6 addr: fe80::3069:f5ff:fe10:823b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1494  Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b)  TX bytes:250 (250.0 b)

+++++++++++++++++文章必备精彩PS与正文的分割线..+++++++++++++++++++++

PS:ArchLinux下面没有所谓的udevinfo,udevtest程序..但是却有udevadm这个集成化的东东..执行

udevadm test /sys/class/net/usb0

就可以测试规则能不能工作了..

这个规则其实还可以做很多事情,,比如自动挂载啦,设备别名啦,插入设备自动运行啦..相当强大的

This entry was posted in 还是会寂寞 and tagged , , , , , . Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.

4 Responses to 让E6的usblan自动启用

  1. Vote -1 Vote +1大剑 CHINA Google Chrome Windows
    說道:

    很高深的东西

  2. Vote -1 Vote +1卢松松 CHINA Internet Explorer Windows
    說道:

    没看明白,因为我没学过这个

Leave a Reply

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

注意: 评论者允许使用'@user空格'的方式将自己的评论通知另外评论者。例如, ABC是本文的评论者之一,则使用'@ABC '(不包括单引号)将会自动将您的评论发送给ABC。使用'@all ',将会将评论发送给之前所有其它评论者。请务必注意user必须和评论者名相匹配(大小写一致)。

Chat Plugin created by Jake Ruston's Wordpress Plugins - Powered by Hardshell Laptop Cases and Ben 10 Games.