Openwrt Udev Configure(3)
1 Scope of Document
This document describes how to write udev script, when enum usb device maybe produces several interfaces(/dev/ttyUSB*),
if we want to compatible serveral usb modules, udev script is very useful.when module insert or remove, spec udev script will
be called.example: this module have four port, we can enumerated to specific devices(/dev/ttyfdti1,/dev/ttyftdi1,/dev/ttyftdi2,/dev/ttyftdi3).
#add for ftdi usb-serial
ACTION=="add",KERNELS=="1-1.4:1.0",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi0"
ACTION=="add",KERNELS=="1-1.4:1.1",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi1"
ACTION=="add",KERNELS=="1-1.4:1.2",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi2"
ACTION=="add",KERNELS=="1-1.4:1.3",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi3"
#remove for ftdi usb-serial
ACTION=="remove",KERNELS=="1-1.4:1.0",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi0"
ACTION=="remove",KERNELS=="1-1.4:1.1",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi1"
ACTION=="remove",KERNELS=="1-1.4:1.2",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi2"
ACTION=="remove",KERNELS=="1-1.4:1.3",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi3"
2 Requiremen
2.1 Function Requirement
Custom private udev rules,compatible different hardware module.
2.2 Performance Requirement
NA
3 Hardware Overview
NA
4 Functional Description
4.1 Functional Block Diagram
NA
5 Porting
5.1 System configure
Reference: https://wiki.archlinux.org/index.php/Udev_(简体中文)
https://mirrors.edge.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html
example1:
when ec20 module be enumed, it can emum five device interfaces, /dev/tty20ec0,
/dev/tty20ec1,/dev/tty4g,/dev/tty20ec3,/dev/tty20ec4.attention to when enum /dev/tty4g interface, it will run /bin/ifup mobile script to diag-up.
If all internet access modules, its diag port was enumed to /dev/tty4g, we can compible all internet access modules in openwrt rootfs.
# add for ec20
ACTION=="add", ATTRS{modalias}=="usb:v2C7Cp0125d0318dcEFdsc02dp01icFFiscFFipFFin00", ATTRS{bInterfaceNumber}=="00", SYMLINK="tty20ec0"
ACTION=="add", ATTRS{modalias}=="usb:v2C7Cp0125d0318dcEFdsc02dp01icFFisc00ip00in01", ATTRS{bInterfaceNumber}=="01", SYMLINK="tty20ec1"
ACTION=="add", ATTRS{modalias}=="usb:v2C7Cp0125d0318dcEFdsc02dp01icFFisc00ip00in02", ATTRS{bInterfaceNumber}=="02", SYMLINK="tty4g",RUN="/sbin/ifup mobile"
ACTION=="add", ATTRS{modalias}=="usb:v2C7Cp0125d0318dcEFdsc02dp01icFFisc00ip00in03", ATTRS{bInterfaceNumber}=="03", SYMLINK="tty20ec3"
ACTION=="add", ATTRS{modalias}=="usb:v2C7Cp0125d0318dcEFdsc02dp01icFFiscFFipFFin04", ATTRS{bInterfaceNumber}=="04", SYMLINK="tty20ec4"
# remove for ec20
ACTION=="remove", ATTRS{modalias}=="usb:v2C7Cp0125d0318dcEFdsc02dp01icFFiscFFipFFin00", ATTRS{bInterfaceNumber}=="00", SYMLINK="tty20ec0"
ACTION=="remove", ATTRS{modalias}=="usb:v2C7Cp0125d0318dcEFdsc02dp01icFFisc00ip00in01", ATTRS{bInterfaceNumber}=="01", SYMLINK="tty20ec1"
ACTION=="remove", ATTRS{modalias}=="usb:v2C7Cp0125d0318dcEFdsc02dp01icFFisc00ip00in02", ATTRS{bInterfaceNumber}=="02", SYMLINK="tty4g",RUN="/sbin/ifdown mobile"
ACTION=="remove", ATTRS{modalias}=="usb:v2C7Cp0125d0318dcEFdsc02dp01icFFisc00ip00in03", ATTRS{bInterfaceNumber}=="03", SYMLINK="tty20ec3"
ACTION=="remove", ATTRS{modalias}=="usb:v2C7Cp0125d0318dcEFdsc02dp01icFFiscFFipFFin04", ATTRS{bInterfaceNumber}=="04", SYMLINK="tty20ec4"
Example2:
if you have two usb-serial modules, and you
want to distinguish between them, you can reference follow udev script methon:
#add
for ftdi usb-serial
ACTION=="add",KERNELS=="1-1.4:1.0",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi0"
ACTION=="add",KERNELS=="1-1.4:1.1",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi1"
ACTION=="add",KERNELS=="1-1.4:1.2",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi2"
ACTION=="add",KERNELS=="1-1.4:1.3",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi3"
#remove for ftdi usb-serial
ACTION=="remove",KERNELS=="1-1.4:1.0",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi0"
ACTION=="remove",KERNELS=="1-1.4:1.1",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi1"
ACTION=="remove",KERNELS=="1-1.4:1.2",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi2"
ACTION=="remove",KERNELS=="1-1.4:1.3",SUBSYSTEMS=="usb",DRIVERS=="ftdi_sio",SYMLINK+="ttyftdi3"
Openwrt Udev Configure(3)的更多相关文章
- Openwrt WiFi Configure(1)
1 Scope of Document This document describes how to custom wifi option 2 Requiremen 2.1 ...
- Openwrt VLAN Configure(2)
1 Scope of Document This document describes vlan design on nodewrt2p 2 Requiremen 2.1 ...
- [Openwrt 项目开发笔记]:Openwrt平台搭建(一)补遗
[Openwrt项目开发笔记]系列文章传送门:http://www.cnblogs.com/double-win/p/3888399.html 正文: 昨晚上熬夜写了[Openwrt项目开发笔记]:O ...
- [Openwrt 项目开发笔记]:Openwrt平台搭建(一)
[Openwrt项目开发笔记]系列文章传送门:http://www.cnblogs.com/double-win/p/3888399.html 正文: 最近开始着手进行Openwrt平台的物联网网关设 ...
- openwrt 添加 应用(luci-application)
openwrt 添加应用的几个步骤如下: (1)在目录 ./feeds/luci/applications 下添加要增加的应用,譬如 "luci-test" (2)里面应该包含以下 ...
- [Openwrt 项目开发笔记]:Openwrt必要设置(二)
[Openwrt项目开发笔记]系列文章传送门:http://www.cnblogs.com/double-win/p/3888399.html 正文: 前面的两篇blog中,我将如何搭建Openwrt ...
- ASP.NET Core 选项模式源码学习Options Configure(一)
前言 ASP.NET Core 后我们的配置变得更加轻量级了,在ASP.NET Core中,配置模型得到了显著的扩展和增强,应用程序配置可以存储在多环境变量配置中,appsettings.json用户 ...
- udev规则(转)
Writing udev rules by Daniel Drake (dsd)Version 0.74 The most recent version of this document can al ...
- 搭建OpenWrt开发环境(包括编译过程)
OpenWrt是一个高度模块化.高度自动化的嵌入式linux发行版,其编译和安装过程比普通的linux发行版而言,要简单太多了.如果您是新手,您那恐惧的心大可放到肚子里,呵呵.对于新手来说最麻烦的恐怕 ...
随机推荐
- codevs 1380 没有上司的舞会 - 树形动态规划
题目描述 Description Ural大学有N个职员,编号为1~N.他们有从属关系,也就是说他们的关系就像一棵以校长为根的树,父结点就是子结点的直接上司.每个职员有一个快乐指数.现在有个周年庆宴会 ...
- MAC BOOK Air 安装metasploit-framework
Step 1:Xcode命令行开发工具OS X确保它已经安装了Xcode开发工具,在终端执行: xcode-select --install1Step 2:Java SDK安装Java sdk,不能用 ...
- No compatible targets were found Do you wish to a add new Android Virtual Device ?
运行一个Android小程序时提示: No compatible targets were found Do you wish to a add new Android Virtual Device ...
- 在CentOS Linux系统上,添加新的端口,启用ssh服务
SSH作为Linux远程连接重要的方式,如何配置安装linux系统的SSH服务,如何开启SSH? SSH是什么? SSH 为 Secure Shell 由 IETF 的网络工作小组(Network W ...
- 最全的Spring面试题和答案<一>
1.什么是Spring框架?Spring框架有哪些主要模块? Spring框架是一个为Java应用程序的开发提供了综合.广泛的基础性支持的Java平台.Spring帮助开发者解决了开发中基础性的问题, ...
- spring注解注入properties配置文件
早期,如果需要通过spring读取properties文件中的配置信息,都需要在XML文件中配置文件读取方式. 基于XML的读取方式: <bean class="org.springf ...
- C# 给某个方法设定执行超时时间
ManualResetEvent.WaitOne 方法 https://msdn.microsoft.com/en-us/library/system.threading.manualreseteve ...
- js中拼接HTML方式方法及注意事项
博主原创:未经博主允许,不得转载 在前端应用中,经常需要在js中动态拼接HTML页面,比如应用ajax进行局部刷新的时候,就需要在js中拼接HTML页面. 主要规则是将HTML页面的标签拼接为标签字符 ...
- HTTP 随笔
浏览器发送HTTP请求主要分为三部分请求行,Response Headers(响应头信息)和Request Headers(请求头信息). 请求行有分为三部分:请求方法,请求路径和请求协议 请求方法有 ...
- 【Python】【内置函数】【bytes&bytearray&str&array】
[bytes] 英文文档: class bytes([source[, encoding[, errors]]]) Return a new “bytes” object, which is an i ...