当前位置:   article > 正文

一点一滴分析LinkIt Smart 7688 问题汇总_2.4g tx1 power slope /offset (0x5ch~0x5dh)

2.4g tx1 power slope /offset (0x5ch~0x5dh)

目录(?)[+]

定义

$ - 指定Ubuntu系统下命令

# - Openwrt下命令

1. 系统编译

1.1 .config文件

openwrt中,make menuconfig生成.config文件后,我们如何对.config中自定义的差异内容进行进行备份,方便移植到其它的系统中,这是一个问题。当然,有人说有很多简单的方法。但是这些都不是Openwrt开发着所希望看到的。对于Openwrt,开发团队创建了简单的工具scripts/diffconfig.sh`。我们可以采用这个工具进行配置保存工作。

有一个简单的方法,生成diff文件,然后通过Git进行操作,这样我们可以对我们自己的openwrt进行定制备份了。

1.1.1 如何创建config diff文件

  $./scripts/diffconfig.sh > config.diff
   
   
  • 1
  • 1
  • 1

1.1.2 如何使用config diff文件

  1. $cp config.diff .config
  2. $make defconfig
  • 1
  • 2
  • 1
  • 2
  • 1
  • 2

或者

  1. $cat config.diff >> .config
  2. $make defconfig
  • 1
  • 2
  • 1
  • 2
  • 1
  • 2

1.1.3 make meunconfig

  $make menuconfig
   
   
  • 1
  • 1
  • 1

1.1.3 make kernel_menuconfig

$ make kernel_menuconfig
   
   
  • 1
  • 1
  • 1
1.2 编译

系统编译很简单,直接在系统目录下运行make命令就可以了,如果想查看输出信息,可以在make后面增加V=s/V=99。如果是多核系统,可以在后面再增加j=2或其它数字,这代表同时有多个线程同时运行。这样可以提高编译速度。我的系统是单核的,我验证了一下没有任何改善。多核系统可以测试一下。

 $ make V=99
   
   
  • 1
  • 1
  • 1
1.2.1 linux核心编译

如果我们仅仅是想对Linux核心包进行编译,可以采用下面的命令来进行。

 $ make target/linux/{clean,prepare} V=s QUILT=1
   
   
  • 1
  • 1
  • 1
1.2.2 package编译(以Madplay为例)

http://jphome.github.io/blog/2014/03/29/openwrt_sdk.html

全新编译madplay

  1. $ make package/feeds/packages/madplay/{clean,compile,install} V=s
  2. $ make package/feeds/packages/madplay/{compile,install} V=s
  • 1
  • 2
  • 1
  • 2
  • 1
  • 2

重新编译madplay

$ make package/feeds/packages/madplay/compile V=s
   
   
  • 1
  • 1
  • 1
1.2.3 package安装(以Madplay为例)

madplay安装

复制ipk文件到openwrt系统(采用scp命令),然后通过opkg进行安装。

  $ scp bin/ramips/packages/packages/madplay-alsa_0.15.2b-4_ramips_24kec.ipk root@192.168.1.168:/tmp
   
   
  • 1
  • 1
  • 1

安装madplay到openwrt

  1. # root@mylinkit:/tmp# opkg install madplay-alsa_0.15.2b-4_ramips_24kec.ipk
  2. Installing madplay-alsa (0.15.2b-4) to root...
  3. Configuring madplay-alsa.
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

MadPay源码修改

$ wget ftp://ftp.mars.org/pub/mpeg/madplay-0.15.2b.tar.gz
   
   
  • 1
  • 1
  • 1

得到madplay源码,修改player.c,采用FIFO控制方式,然后编译madplay.

  1. $ make package/feeds/packages/madplay/{compile,install} V=s
  2. $ scp bin/ramips/packages/packages/madplay-alsa_0.15.2b-4_ramips_24kec.ipk root@192.168.1.168:/tmp
  3. # opkg install madplay-alsa_0.15.2b-4_ramips_24kec.ipk
  4. # madplay /Media/USB-A1/*.mp3
  5. # echo f > /tmp/.madplayFIFO
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

创建madplayCon.c文件

# make package/feeds/packages/gogoo/ethMOH/{clean,compile,install} V=s

   
   
  • 1
  • 2
  • 1
  • 2
  • 1
  • 2
  1. KEY_PAUSE = 'p',
  2. KEY_STOP = 's',
  3. KEY_FORWARD = 'f',
  4. KEY_BACK = 'b',
  5. KEY_TIME = 't',
  6. KEY_QUIT = 'q',
  7. KEY_INFO = 'i',
  8. KEY_GAINDECR = '-',
  9. KEY_GAININCR = '+',
  10. KEY_GAINZERO = '_',
  11. KEY_GAININFO = '='
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
1.3 dts文件修改

1.3.1 按钮相关修改

MT7688按钮一组为32个,所以GPIO0组对应GPIO0-PIO32,GPIO1组对应GPIO32以上的引脚。

参考连接https://wiki.openwrt.org/doc/howto/hardware.button?s[]=button&s[]=hotplug

  1. gpio-keys-polled {
  2. compatible = "gpio-keys-polled";
  3. #address-cells = <1>;
  4. #size-cells = <0>;
  5. poll-interval = <20>;
  6. wps {
  7. label = "wps";
  8. gpios = <&gpio1 6 1>; // GPIO38 wifi button
  9. linux,code = <0x211>;
  10. };
  11. key_playpause {
  12. label = "key_playpause";
  13. gpios = <&gpio0 15 1>; // GPIO15-KEY_PLAY/Pause(S5)
  14. linux,code = <164>;
  15. };
  16. key_volumeup {
  17. label = "key_volumeup";
  18. gpios = <&gpio0 17 1>; //GPIO17-KEY_VOL+(S7)
  19. linux,code = <115>;
  20. };
  21. key_volumedown {
  22. label = "key_volumedown";
  23. gpios = <&gpio0 18 1>; //GPIO18-KEY_VOL-(S8)
  24. linux,code = <114>;
  25. };
  26. key_next {
  27. label = "key_next";
  28. gpios = <&gpio0 16 1>; //GPIO16-KEY_NEXT(S6)
  29. linux,code = <0x197>;
  30. };
  31. key_previous {
  32. label = "key_previous";
  33. gpios = <&gpio0 14 1>; //GPIO14-KEY_PRE(S4)
  34. linux,code = <0x19c>;
  35. };
  36. };
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37

尖括号中的内容为标准按键代码,可以在linux/include/uapi/linux/input.h中查询到。

1.3.2 SD卡检测引脚电平修改

LinkIt smart7688的SD卡检测,默认是高电平。但是普通的SD卡是低电平。所以,要对dts进行修改。使用下面命令:

$ vi target/linux/ramips/dts/LINKIT7688.dts
   
   
  • 1
  • 1
  • 1

修改前:

  1. sdhci@10130000 {
  2. status = "okay";
  3. mediatek,cd-high;
  4. // mediatek,cd-poll;
  5. };
  • 1
  • 2
  • 3
  • 4
  • 5
  • 1
  • 2
  • 3
  • 4
  • 5
  • 1
  • 2
  • 3
  • 4
  • 5

修改后:

  1. sdhci@10130000 {
  2. status = "okay";
  3. mediatek,cd-low;
  4. // mediatek,cd-poll;
  5. };
  • 1
  • 2
  • 3
  • 4
  • 5
  • 1
  • 2
  • 3
  • 4
  • 5
  • 1
  • 2
  • 3
  • 4
  • 5
1.4 package创建

package的Makefile

  • PKG_NAME - The name of the package, as seen via menuconfig and ipkg
  • PKG_VERSION - The upstream version number that we’re downloading
  • PKG_RELEASE - The version of this package Makefile
  • PKG_LICENSE - The license(s) the package is available under, SPDX form.
  • PKG_LICENSE_FILE- file containing the license text
  • PKG_BUILD_DIR - Where to compile the package
  • PKG_SOURCE - The filename of the original sources
  • PKG_SOURCE_URL - Where to download the sources from (directory)
  • PKG_MD5SUM - A checksum to validate the download
  • PKG_CAT - How to decompress the sources (zcat, bzcat, unzip)
  • PKG_BUILD_DEPENDS - Packages that need to be built before this package, but are not required at runtime. Uses the same syntax as DEPENDS below.
  • PKG_INSTALL - Setting it to “1” will call the package’s original “make install” with prefix set to PKG_INSTALL_DIR
  • PKG_INSTALL_DIR - Where “make install” copies the compiled files
  • PKG_FIXUP - See below
  • PKG_SOURCE_PROTO - the protocol to use for fetching the sources (git, svn)
  • PKG_REV - the svn revision to use, must be specified if proto is “svn”
  • PKG_SOURCE_SUBDIR - must be specified if proto is “svn” or “git”, e.g. “PKG_SOURCE_SUBDIR:=(PKG_VERSION)”
  • PKG_SOURCE_VERSION - must be specified if proto is “git”, the commit hash to check out
  • PKG_CONFIG_DEPENDS - specifies which config options depend on this package being selected
  • SECTION - The type of package (currently unused) //包的类型
  • CATEGORY - Which menu it appears in menuconfig //menuconfig的哪一个菜单显示
  • TITLE - A short description of the package //包的简短描述
  • DESCRIPTION - (deprecated) A long description of the package //报的一个长描述
  • URL - Where to find the original software // 那里找到源软件
  • MAINTAINER - (required for new packages) Who to contact concerning the package // 包的联系
  • DEPENDS - (optional) Which packages must be built/installed before this package. See below for the syntax. // 哪些包需要必须先编译/安装
  • PKGARCH - (optional) Set this to “all” to produce a package with “Architecture: all”
  • USERID - (optional) a username:groupname pair to create at package installation time.
1.5 JFFS2-Journalling Flash File System Version2

JFFS2全名是 Journalling Flash File System Version2,是Redhat公司开发的闪存文件系统[1],其前身是JFFS, 最早只支持NOR Flash, 自2.6版以后开始支持NAND Flash, 极适合使用于嵌入式系统。https://zh.wikipedia.org/wiki/JFFS2

1.5 如何创建自己的板子支持

增加mt7688支持 
参考CC代码:(CC-2015/10/19 18:19:18-SHA-1: 3d98b29a3d0aa854fad712a92ace42ad06e92d6b) 
* 修改target\linux\ramips\Makefile文件,增加mt7688支持 
* 修改target\linux\ramips\modules.mk文件,增加TARGET_ramips_mt7688支持 
* 创建target\linux\ramips\mt7688\config-3.18文件 
* 创建target\linux\ramips\mt7688\profiles\00-default.mk文件 
* 创建target\linux\ramips\mt7688\target.mk文件

增加LinkIt Smart7688支持 
参考CC代码:(CC-2015/10/19 18:19:22-SHA-1: 8829dee8871e45c675a4bd4036c188c6d0f5645b) 
* 在package\boot\uboot-envtools\files\ramips添加linkits7688板名支持 
* 在target\linux\ramips\base-files\etc\board.d\02_network添加linkits7688支持 
* 在target\linux\ramips\base-files\lib\ramips.sh中添加linkits7688支持 
* 在target\linux\ramips\base-files\lib\upgrade\platform.sh中添加linkits7688支持 
* 增加target\linux\ramips\dts\LINKIT7688.dts文件 
* 修改target\linux\ramips\image\Makefile文件 
* 增加target\linux\ramips\mt7688\profiles\01-mediatek.mk文件

参考windora 
* 修改target\linux\ramips\base-files\etc\board.d\02_network 
* 修改target\linux\ramips\base-files\lib\ramips.sh 
* 修改target\linux\ramips\base-files\lib\upgrade\platform.sh 
* 修改target\linux\ramips\image\Makefile 
* 创建一个*.mk文件到target\linux\ramips\mt7688\profiles\目录下 
* 创建一个example.dts文件到target\linux\ramips\dts\目录下

  1. root@mylinkit:~# cat /proc/cpuinfo
  2. system type : MediaTek MT7688 ver:1 eco:2
  3. machine : MediaTek LinkIt Smart 7688
  4. processor : 0
  5. cpu model : MIPS 24KEc V5.5
  6. BogoMIPS : 385.84
  7. wait instruction : yes
  8. microsecond timers : yes
  9. tlb_entries : 32
  10. extra interrupt vector : yes
  11. hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
  12. isa : mips1 mips2 mips32r1 mips32r2
  13. ASEs implemented : mips16 dsp
  14. shadow register sets : 1
  15. kscratch registers : 0
  16. package : 0
  17. core : 0
  18. VCED exceptions : not available
  19. VCEI exceptions : not available
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
1.6 rpcd - (OpenWrt ubus RPC backend server)
1.7 patch

http://blog.csdn.net/wwx0715/article/details/25160361

  1. $ quilt --help
  2. 用法:quilt [--trace[=verbose]] [--quiltrc=XX] command [-h] ...
  3. quilt --version
  4. 命令是:
  5. add fold new remove top
  6. annotate fork next rename unapplied
  7. applied graph patches revert upgrade
  8. delete grep pop series
  9. diff header previous setup
  10. edit import push shell
  11. files mail refresh snapshot
  12. Global options:
  13. --trace
  14. Runs the command in bash trace mode (-x). For internal debugging.
  15. --quiltrc file
  16. Use the specified configuration file instead of ~/.quiltrc (or
  17. /etc/quilt.quiltrc if ~/.quiltrc does not exist). See the pdf
  18. documentation for details about its possible contents. The
  19. special value "-" causes quilt not to read any configuration
  20. file.
  21. --version
  22. Print the version number and exit immediately.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

1.7.1 准备quilt配置

$ cd ~
   
   
  • 1
  • 1
  • 1
  1. cat > ~/.quiltrc <<EOF
  2. QUILT_DIFF_ARGS="--no-timestamps --no-index -p ab --color=auto"
  3. QUILT_REFRESH_ARGS="--no-timestamps --no-index -p ab"
  4. QUILT_PATCH_OPTS="--unified"
  5. QUILT_DIFF_OPTS="-p"
  6. EDITOR="nano"
  7. EOF
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

**1.7.2

  1. $ cd ~/openwrt/openwrt_ethMOH/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7688/linux-3.18.29/
  2. $ quilt series
  3. $ quilt new platform/502-alsa.patch
  4. $ quilt edit sound/soc/codecs/wm8960.c
  5. $ quilt diff
  6. $ quilt refresh
  7. $ cd ../../../../
  8. $ make target/linux/update package/index V=s
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

修改存在的patch

  1. $ quilt push platform/502-alsa.patch
  2. $ quilt edit sound/soc/codecs/wm8960.c
  3. $ quilt diff
  4. $ quilt refresh
  5. $ cd ../../../../
  6. $ make target/linux/update V=s //民间更新patch到target/linux/ramips/patches-xxx方法
  7. /$ make target/linux/update package/index V=s //官方更新patch到target/linux/ramips/patches-xxx方法
  8. $ make target/linux/{clean,prepare} V=s QUILT=1
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
1.8 Makefile
  1. $? - 当前目标所依赖的文件列表中比当前目标文件还要新的文件
  2. $@ - 当前目标名字
  3. $< - 当前依赖文件的名字
  4. $* - 不包括后缀名的当前依赖文件的名字
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
1.9 WM8960声卡

Linkit的默认的声卡是WM8960,该声卡为I2S接口。Linkit默认WM8960使用的为外部晶振提供时钟频率。所以如果我们希望采用MT7688的REF_CLK0信号作为WM8960的时钟信号的话,我们就需要对MTK的配置文件进行一些修改。 
具体的修改可以参考https://github.com/hnhkj/CC15.05.git的代码。

1.10 USB声卡CM108

https://wiki.openwrt.org/doc/howto/usb.audio?s[]=sound

1.11 wps 功能 (don’t support)

http://labs.mediatek.com/forums/posts/list/4850.page

1.12 init.d/rc.d开机自动运行

参考文档:https://wiki.openwrt.org/doc/techref/initscripts

启动方法: 
1,创建脚本到 init.d(具体参考原来文档)。 
2,开机自动运行./etc/init.d/example enable。 
3, 使能自动运行可以在/etc/rc.d/ 下查找到连接

1.13 eclipse

http://downloads.openwrt.org/docs/eclipse.pdf

2. 系统配置

2.1 MTD

参考连接:https://wiki.openwrt.org/doc/techref/mtd

  1. root@mylinkit:~# mtd
  2. Usage: mtd [<options> ...] <command> [<arguments> ...] <device>[:<device>...]
  3. The device is in the format of mtdX (eg: mtd4) or its label.
  4. mtd recognizes these commands:
  5. unlock unlock the device
  6. refresh refresh mtd partition
  7. erase erase all data on device
  8. verify <imagefile>|- verify <imagefile> (use - for stdin) to device
  9. write <imagefile>|- write <imagefile> (use - for stdin) to device
  10. jffs2write <file> append <file> to the jffs2 partition on the device
  11. fixseama fix the checksum in a seama header on first boot
  12. Following options are available:
  13. -q quiet mode (once: no [w] on writing,
  14. twice: no status messages)
  15. -n write without first erasing the blocks
  16. -r reboot after successful command
  17. -f force write without trx checks
  18. -e <device> erase <device> before executing the command
  19. -d <name> directory for jffs2write, defaults to "tmp"
  20. -j <name> integrate <file> into jffs2 data when writing an image
  21. -s <number> skip the first n bytes when appending data to the jffs2 partiton, defaults to "0"
  22. -p write beginning at partition offset
  23. -l <length> the length of data that we want to dump
  24. Example: To write linux.trx to mtd4 labeled as linux and reboot afterwards
  25. mtd -r write linux.trx linux
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 2.1.1 如何显示MTD状态
  1. root@mylinkit:/tmp# cat /proc/mtd
  2. dev: size erasesize name
  3. mtd0: 00030000 00010000 "u-boot"
  4. mtd1: 00010000 00010000 "u-boot-env"
  5. mtd2: 00010000 00010000 "factory"
  6. mtd3: 00fb0000 00010000 "firmware"
  7. mtd4: 0011a791 00010000 "kernel"
  8. mtd5: 00e9586f 00010000 "rootfs"
  9. mtd6: 00100000 00010000 "rootfs_data"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 2.1.2 dd命令:/bin/dd 
    读取mtd2内的数据内容,mac地址
  # dd bs=1 skip=3 count=6 if=/dev/mtd2 2>/dev/null | hexdump
   
   
  • 1
  • 1
  • 1

参考文档:linkit-smart-7688-feed\mtk-linkit\files\etc\uci-defaults\51_linkit_config - Line30:

MAC=$(dd bs=1 skip=7 count=3 if=/dev/mtd2 2>/dev/null | hexdump -v -n 3 -e '3/1 "%02X"'
   
   
  • 1
  • 1
  • 1
  • 2.1.3 入如何写firmware到flash.
  1. # cd /tmp
  2. # wget http://www.example.org/original_firmware.bin
  3. # mtd -r write /tmp/original_firmware.bin firmware
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
  • 2.1.4 备份MTD2/factory信息
  # dd if=/dev/mtd2 of=/tmp/factory.bin
   
   
  • 1
  • 1
  • 1
  • 2.1.5 写factory.bin到mtd2
  # mtd -r write /tmp/factory.bin factory
   
   
  • 1
  • 1
  • 1

注意:如果命令返回不能写入MTD2,可能是由于你的系统设定了禁止写该区域的权限。我们可以通过修改target/linux/ramips/dts/LINKIT7688.dts,注销禁止代码。这样就可以将数据写入到MTD2区域了。

  1. I know that we can modify LINKIT7688 file to allow mtd command modify mtd2's data.
  2. /target/linux/ramips/dts/LINKIT7688
  3. line82-86:
  4. factory: partition@40000 {
  5. label = "factory";
  6. reg = <0x40000 0x10000>;
  7. read-only;
  8. };
  9. delete read-only.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • fw_printenv命令:/usr/sbin/fw_printenv

参考文档:linkit-smart-7688-feed\mtk-linkit\files\etc\init.d\linkit

Line15:

SEQ=fw_printenv -n wifi_seq

2.2 用SD卡扩展空间(未验证)

参考: http://labs.mediatek.com/forums/posts/list/4121.page

  1. Yes!you can mount tf card as overlay
  2. 1.install block-mount e2fsprogs kmod-fs-ext4
  3. 2.mkfs.ext4 /dev/mmcblk0
  4. 3.block detect > /etc/config/fstab
  5. 4.vi etc/config/fstab
  6. modify option 'target' '/overlay'
  7. modify option 'enable' '1'
  8. 5.reboot,use df -h check
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
2.3 ifconfig 相关参数

状态:Ethernet0 连接PC,Wifi连接Router (状态非常好)

  1. ifconfig
  2. apcli0 Link encap:Ethernet HWaddr 9E:65:F9:0B:18:55
  3. inet addr:192.168.1.104 Bcast:192.168.1.255 Mask:255.255.255.0
  4. inet6 addr: fe80::9c65:f9ff:fe0b:1855/64 Scope:Link
  5. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  6. RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  7. TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
  8. collisions:0 txqueuelen:1000
  9. RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
  10. br-lan Link encap:Ethernet HWaddr 9C:65:F9:1B:10:27
  11. inet addr:192.168.100.1 Bcast:192.168.100.255 Mask:255.255.255.0
  12. inet6 addr: fe80::9e65:f9ff:fe1b:1027/64 Scope:Link
  13. inet6 addr: fdef:dd3c:f1e1::1/60 Scope:Global
  14. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  15. RX packets:478 errors:0 dropped:0 overruns:0 frame:0
  16. TX packets:340 errors:0 dropped:0 overruns:0 carrier:0
  17. collisions:0 txqueuelen:0
  18. RX bytes:45279 (44.2 KiB) TX bytes:46562 (45.4 KiB)
  19. eth0 Link encap:Ethernet HWaddr 9C:65:F9:1B:10:27
  20. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  21. RX packets:525 errors:0 dropped:0 overruns:0 frame:0
  22. TX packets:307 errors:0 dropped:0 overruns:0 carrier:0
  23. collisions:0 txqueuelen:1000
  24. RX bytes:70666 (69.0 KiB) TX bytes:46599 (45.5 KiB)
  25. Interrupt:5
  26. eth0.1 Link encap:Ethernet HWaddr 9C:65:F9:1B:10:27
  27. inet6 addr: fe80::9e65:f9ff:fe1b:1027/64 Scope:Link
  28. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  29. RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  30. TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
  31. collisions:0 txqueuelen:0
  32. RX bytes:0 (0.0 B) TX bytes:5911 (5.7 KiB)
  33. lo Link encap:Local Loopback
  34. inet addr:127.0.0.1 Mask:255.0.0.0
  35. inet6 addr: ::1/128 Scope:Host
  36. UP LOOPBACK RUNNING MTU:65536 Metric:1
  37. RX packets:1269 errors:0 dropped:0 overruns:0 frame:0
  38. TX packets:1269 errors:0 dropped:0 overruns:0 carrier:0
  39. collisions:0 txqueuelen:0
  40. RX bytes:88230 (86.1 KiB) TX bytes:88230 (86.1 KiB)
  41. ra0 Link encap:Ethernet HWaddr 9C:65:F9:1B:18:55
  42. inet6 addr: fe80::9e65:f9ff:fe1b:1855/64 Scope:Link
  43. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  44. RX packets:11176 errors:0 dropped:0 overruns:0 frame:0
  45. TX packets:2457 errors:0 dropped:0 overruns:0 carrier:0
  46. collisions:0 txqueuelen:1000
  47. RX bytes:2248608 (2.1 MiB) TX bytes:42335 (41.3 KiB)
  48. Interrupt:6
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
2.4 network 配置
  1. config interface 'loopback'
  2. option ifname 'lo'
  3. option proto 'static'
  4. option ipaddr '127.0.0.1'
  5. option netmask '255.0.0.0'
  6. config globals 'globals'
  7. option ula_prefix 'fd01:80d1:1f98::/48'
  8. config interface 'lan'
  9. option ifname 'eth0'
  10. option force_link '1'
  11. option type 'bridge'
  12. option proto 'static'
  13. option netmask '255.255.255.0'
  14. option ip6assign '60'
  15. option ipaddr '192.168.100.1'
  16. option macaddr '00:0c:43:e1:76:2a'
  17. config switch
  18. option name 'switch0'
  19. option reset '1'
  20. option enable_vlan '0'
  21. config interface 'wan'
  22. option proto 'dhcp'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
2.5 eeprom配置

eepromn内容可以在/lib/firmware/mt7628.eeprom中。

  • 2.1 - Chip ID(0x00h)
  • 2.2 - Layout Revision ID(0x02)
  • 2.3 - WIFI MAC Address (0x04)
  • 2.4 - WIFI MAC Address (0x28)
  • 2.5 - WIFI MAC Address (0x2E)
  • 2.6 - NIC Configuration 0 (0x34)
  • 2.7 - NIC Configuration 1 (0x36)
  • 2.8 - Country Region Code for 2.4G band (0x39)
  • 2.9 - LED Mode (0x3B)
  • 2.10 - NIC COnfiguration 2 (0x42)
  • 2.11 - RSSI Offset for 2.4G band (0x46)
  • 2.12 - 20M/40M BW Power Delta for 2.4G band (0x50)
  • 2.13 - Temp. Sensor Calibation (0x55)
  • 2.14 - 2.4G Tx0 Power Slope/offset (0x56~0x57)
  • 2.15 - 2.4G Tx0 Target Power (0x58)
  • 2.16 - 2.4G Tx0 Power Low/Middle/High Channel (0x59)
  • 2.17 - 2.4G Tx1 Power Slope/Offset (0x5C~0x5D)
  • 2.18 - 2.4G Tx1 Target Power (0x5E)
  • 2.19 - 2.4G Tx1 Power Offset Low/Middle/High Channel (0x5F~0x61)
  • 2.20 - 2.4G Tx rate power configuration (0xA0~0xBF)
  • 2.21 - External LNA (0xC0)
  • 2.22 - 2.4GHz Step Number (0xC6)
  • 2.23 - Frequency offset (0xF4~0xF6)
  • 2.24 - Reserved for Customer (0x140~0x1EF)
2.6 Sysupgrade

https://wiki.openwrt.org/doc/howto/generic.sysupgrade

与opkg, mtd 等相比, sysupgrade 仅仅是个shell脚本: /sbin/sysupgrade 诣在更容易的实现系统更新.

timezone //时区

时区设置保存在/tmp/TZ中。

  1. root@mylinkit:/tmp# cat TZ
  2. UTC
  • 1
  • 2
  • 1
  • 2
  • 1
  • 2
2.7 uhttpd

https://wiki.openwrt.org/doc/howto/http.uhttpd

2.8 修改Linkit_Smart_7688默认的SSID

mtk-linkit\files\etc\uci-defaults\51\_linkit\_config文件中,默认是读取wifi MAC address的后3个字节,加载到字符串LiniIt_Smart_7688_的后面,根据MAC地址的唯一性,形成一个唯一的SSID地址。如果我们想修改该SSID的话,可以在这个文件中进行修改。又或者配置SSID到uboot环境变量中,形成自己的SSID。这部分实现可以参考lks7688.cfg部分。如果系统在uboot中设置了SSID的话,系统将显示该SSID。如果没有设置的话,系统将设置该文件配置的SSID。

  1. [ -n "${SSID}" ] || { \
  2. MAC=$(dd bs=1 skip=7 count=3 if=/dev/mtd2 2>/dev/null | hexdump -v -n 3 -e '3/1 "%02X"')
  3. SSID=LinkIt_Smart_7688_${MAC}
  4. }
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
2.9 修改Linkit_Smart_7688的版本号

Linkit_Smart_7688默认拥有自己的版本号,该版本号定义在mtk-linkit\files\etc\uci-defaults\54_linkit_version文件中。

uci set system.@system[0].firmware_version=v0.9.3
   
   
  • 1
  • 1
  • 1
2.10 修改Linkit_Smart_7688的主机名

Linkit_Smart_7688的主机名在mtk-linkit\files\etc\uci-defaults\51_linkit_config文件中定义,你可以通过修改这个文件来修改主机名。

uci set system.@system[-1].hostname="mylinkIt"
   
   
  • 1
  • 1
  • 1
2.11 获得Linkit_Smart_7688的MAC地址

对于如何获取MAC地址,OpenWrt提供了详细的程序接口。可以参考\openwrt\package\base-files\files\lib\functions\system.sh文件,该文件包含的mac的操作函数。在很多的sh文档中都包含的对该文件的引用。

例如:mtk-linkit\files\etc\uci-defaults\51_linkit_config文件中的wan_mac获取。

wan_mac=$(mtd_get_mac_binary factory 4)
   
   
  • 1
  • 1
  • 1

获取ap_mac地址(源自:mtk-linkit\files\etc\rc.button\wps 
文件):

iwinfo ra0 info | grep Access | awk '{print $3}')
   
   
  • 1
  • 1
  • 1
2.12 Linkit_Smart_7688默认模组的添加和删除

Linkit_Smart_7688默认添加了很多的模组,例如:PythonNode.js等。我们如何对默认的模组进行修改,添加或删除想要的模组呢。其实很简单,我们就是需要修改mtk-linkit\Makefile,在该文件中修改想要或不想要的模组。然后feed install它就可以了。当然,你会发现已经安装过的模组,在文件中删除后,编译后仍然会在firmware中,这是怎么回事呢?这是因为,在编译默认的Makefile的时候,系统通过feed已经将原来默认的模组添加进了.config。如果要删除它们,需要同feed来删除它们。然后,编译以后就不会出现了。

  1. define Package/mtk-linkit
  2. TITLE:=MTK LinkIt Smart board support package
  3. HIDDEN:=1
  4. DEPENDS:=@TARGET_ramips_mt7688_LinkIt7688 \
  5. +gdbserver +curl +strace +coreutils +coreutils-stty \
  6. +avahi-nodbus-daemon +mountd +mjpg-streamer \
  7. +uhttpd +rpcd +rpcd-mod-iwinfo +git +git-http +samba36-server \
  8. +python +python-pyserial +python-pip +hidapi \
  9. +libmraa +libupm +node +node-hid +node-cylon-firmata +yunbridge \
  10. +luci +luci-theme-openwrt +luci-app-mjpg-streamer +luci-app-samba +luci-lib-json \
  11. +rpcd-mod-rpcsys +cgi-io +avrdude +spi-tools +uboot-envtools \
  12. +kmod-fs-vfat +kmod-fs-exfat +kmod-i2c-core +kmod-i2c-ralink \
  13. +kmod-nls-base +kmod-nls-cp437 +kmod-nls-iso8859-1 \
  14. +kmod-nls-iso8859-15 +kmod-nls-iso8859-2 +kmod-nls-utf8 \
  15. +kmod-sdhci-mt7620 +kmod-usb-storage \
  16. +kmod-video-core +kmod-video-uvc \
  17. +kmod-sound-core +kmod-sound-mtk +madplay-alsa +alsa-utils \
  18. +mtk-linkit-webui +mtk-sdk-wifi +tcpdump-mini
  19. CATEGORY:=Base system
  20. DEFAULT:=y
  21. endef
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
2.13 如果修改Linkit_Smart_7688默认opkg连接地址
  1. ubuntu@ubuntu-System-Name:~/openwrt/openwrt_ethMOH$ cat feeds.conf.default
  2. src-git packages https://github.com/openwrt/packages.git;for-15.05
  3. src-git luci https://github.com/openwrt/luci.git;for-15.05
  4. src-git routing https://github.com/openwrt-routing/packages.git;for-15.05
  5. src-git telephony https://github.com/openwrt/telephony.git;for-15.05
  6. src-git management https://github.com/openwrt-management/packages.git;for-15.05
  7. #src-git targets https://github.com/openwrt/targets.git
  8. #src-git oldpackages http://git.openwrt.org/packages.git
  9. #src-svn xwrt http://x-wrt.googlecode.com/svn/trunk/package
  10. #src-svn phone svn://svn.openwrt.org/openwrt/feeds/phone
  11. #src-svn efl svn://svn.openwrt.org/openwrt/feeds/efl
  12. #src-svn xorg svn://svn.openwrt.org/openwrt/feeds/xorg
  13. #src-svn desktop svn://svn.openwrt.org/openwrt/feeds/desktop
  14. #src-svn xfce svn://svn.openwrt.org/openwrt/feeds/xfce
  15. #src-svn lxde svn://svn.openwrt.org/openwrt/feeds/lxde
  16. #src-link custom /usr/src/openwrt/custom-feed
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

该连接地址的修改主要修改一个文件mtk-linkit\files\etc\opkg\linkit.conf。我们可以通过修改这个文件中的文件指向你的opkg连接地址,然后编译。编译后出的OS就可以通过opkg install连接你的服务器了。当然,如果你不想使用Linkit_Smart_7688默认的opkg连接地址的话,你可以在mtk-linkit\files\etc\init.d\linkit文件中删除对linkit.conf的初始化部分,这样在OpenWrt启动的时候就不会讲linit.conf添加/etc/opkg/distfeeds.conf

当然,如果你不想修改系统,只是在OpenWrt中修改opkg连接地址的话,那也很简单。你只要用vi命令修改/etc/opkg/distfeeds.conf文件就可以了。这也很简单。

2.14 如果修改Linkit_Smart_7688默认lan ipaddress.

默认的Lan IPAddress在OpenWrt的/etc/config/network文件中设置,如果想修改ip地址。可以在linkit-smart-7688-feed\mtk-linkit\files\etc\uci-defaults\51_linkit_config文件中进行修改。linkit-smart-7688-feed默认的Lan ipaddr 是 192.168.100.1

2.15 如果修改Linkit_Smart_7688的GPIO11.

Linkit_Smart_7688的GPIO11引脚,默认用来锁定CL245A芯片的。该芯片是一个锁存器,用来提升MT7688的引脚输出功率和保护MT7688的引脚功能。但是,如果你不需要这个功能,希望将GPIO11引脚释放出来的话。你可以对源代码进行一些修改或者删除。MTK在linux中增加了一个驱动,用来驱动GPIO11引脚的。详细内容可以参考target\linux\ramips\patches-3.18\0200-linkit_bootstrap.patch文件。

2.16 aplay多声卡的使用

Linkit默认使用WM8960声卡,现在增加了一个USB声卡,声卡检测发现了该USB声卡。http://alsa.opensrc.org/MultipleCards

2.16.1 aplay查询有效声卡 aplay -l

  1. root@mylinkit:/# aplay -l
  2. **** List of PLAYBACK Hardware Devices ****
  3. card 0: I2S [MTK APSoC I2S], device 0: WMserious PCM wm8960-hifi-0 []
  4. Subdevices: 1/1
  5. Subdevice #0: subdevice #0
  6. card 1: Set [C-Media USB Headphone Set], device 0: USB Audio [USB Audio]
  7. Subdevices: 1/1
  8. Subdevice #0: subdevice #0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

2.16.2 用指定的声卡播放 aplay -Dhw:x (x=0,x=1)

  1. root@mylinkit:/# aplay -Dhw:1 /Media/SD-P1/*.wav
  2. Playing WAVE '/Media/SD-P1/1.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
  • 1
  • 2
  • 1
  • 2
  • 1
  • 2

2.16.3 aply -h

  1. root@mylinkit:/# aplay -h
  2. Usage: aplay [OPTION]... [FILE]...
  3. -h, --help help
  4. --version print current version
  5. -l, --list-devices list all soundcards and digital audio devices
  6. -L, --list-pcms list device names
  7. -D, --device=NAME select PCM by name
  8. -q, --quiet quiet mode
  9. -t, --file-type TYPE file type (voc, wav, raw or au)
  10. -c, --channels=# channels
  11. -f, --format=FORMAT sample format (case insensitive)
  12. -r, --rate=# sample rate
  13. -d, --duration=# interrupt after # seconds
  14. -M, --mmap mmap stream
  15. -N, --nonblock nonblocking mode
  16. -F, --period-time=# distance between interrupts is # microseconds
  17. -B, --buffer-time=# buffer duration is # microseconds
  18. --period-size=# distance between interrupts is # frames
  19. --buffer-size=# buffer duration is # frames
  20. -A, --avail-min=# min available space for wakeup is # microseconds
  21. -R, --start-delay=# delay for automatic PCM start is # microseconds
  22. (relative to buffer size if <= 0)
  23. -T, --stop-delay=# delay for automatic PCM stop is # microseconds from xrun
  24. -v, --verbose show PCM structure and setup (accumulative)
  25. -V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)
  26. -I, --separate-channels one file for each channel
  27. -i, --interactive allow interactive operation from stdin
  28. -m, --chmap=ch1,ch2,.. Give the channel map to override or follow
  29. --disable-resample disable automatic rate resample
  30. --disable-channels disable automatic channel conversions
  31. --disable-format disable automatic format conversions
  32. --disable-softvol disable software volume control (softvol)
  33. --test-position test ring buffer position
  34. --test-coef=# test coefficient for ring buffer position (default 8)
  35. expression for validation is: coef * (buffer_size / 2)
  36. --test-nowait do not wait for ring buffer - eats whole CPU
  37. --max-file-time=# start another output file when the old file has recorded
  38. for this many seconds
  39. --process-id-file write the process ID here
  40. --use-strftime apply the strftime facility to the output file name
  41. --dump-hw-params dump hw_params of the device
  42. --fatal-errors treat all errors as fatal
  43. Recognized sample formats are: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW A_LAW IMA_ADPCM MPEG GSM SPECIAL S24_3LE S24_3BE U24_3LE U24_3BE S20_3LE S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE U18_3BE G723_24 G723_24_1B G723_40 G723_40_1B DSD_U8 DSD_U16_LE
  44. Some of these may not be available on selected hardware
  45. The available format shortcuts are:
  46. -f cd (16 bit little endian, 44100, stereo)
  47. -f cdr (16 bit big endian, 44100, stereo)
  48. -f dat (16 bit little endian, 48000, stereo)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49

2.16.4 arecord & aplay test

  1. arecord -f cd -t wav -M /Media/USB-A1/my_recording.wav
  2. aplay -M my_recording.wav
  • 1
  • 2
  • 1
  • 2
  • 1
  • 2

2.16.5 参考连接:

http://alsa.opensrc.org/

http://www.cnblogs.com/cslunatic/p/3227655.html 
http://blog.chinaunix.net/uid-26588712-id-3054726.html 
https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29#.E8.AE.BE.E7.BD.AE.E9.BB.98.E8.AE.A4.E5.A3.B0.E5.8D.A1

2.17 madplay

http://www.crystalradio.cn/thread-466848-1-1.html 
http://blog.csdn.net/fengliang191/article/details/19763579

madplay默认按键

  1. The keyboard controls are documented in the man page for madplay:
  2. P Pause; press any key to resume.
  3. S Stop; press any key to replay the current file
  4. from the beginning.
  5. F Forward; advance to the next file.
  6. B Back; replay the current file, unless it has
  7. been playing for less than 4 seconds, in which
  8. case replay the previous file.
  9. T Time display; change the time display mode. This
  10. only works with -v (--verbose). The display
  11. mode alternates among overall playing time, cur-
  12. rent time remaining, and current playing time.
  13. + Increase gain; increase the audio output gain by
  14. 0.5 dB.
  15. - Decrease gain; decrease the audio output gain by
  16. 0.5 dB.
  17. Q Quit; stop decoding and exit.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  1. root@mylinkit:~# madplay -h
  2. Usage: madplay [OPTIONS] FILE [...]
  3. Decode and play MPEG audio FILE(s).
  4. Verbosity:
  5. -v, --verbose show status while decoding
  6. -q, --quiet be quiet but show warnings
  7. -Q, --very-quiet be quiet and do not show warnings
  8. --display-time=MODE use default verbose time display MODE
  9. (remaining, current, overall)
  10. Decoding:
  11. --downsample reduce sample rate 2:1
  12. -i, --ignore-crc ignore CRC errors
  13. --ancillary-output=PATH write ancillary data to PATH
  14. Audio output:
  15. -o, --output=[TYPE:]PATH write output to PATH with format TYPE (below)
  16. -b, --bit-depth=DEPTH request DEPTH bits per sample
  17. -R, --sample-rate=HERTZ request HERTZ samples per second
  18. -d, --no-dither do not dither output PCM samples
  19. --fade-in[=DURATION] fade-in songs over DURATION (default 0:05)
  20. -a, --attenuate=DECIBELS attenuate signal by DECIBELS (-)
  21. -a, --amplify=DECIBELS amplify signal by DECIBELS (+)
  22. -A, --adjust-volume=DECIBELS override per-file volume adjustments
  23. -G, --replay-gain[=PROFILE] enable Replay Gain volume adjustments using
  24. PROFILE (radio, audiophile)
  25. Channel selection:
  26. -1, --left output first (left) channel only
  27. -2, --right output second (right) channel only
  28. -m, --mono mix left and right channels for monaural output
  29. -S, --stereo force stereo output
  30. Playback:
  31. -s, --start=TIME skip to begin at TIME (HH:MM:SS.DDD)
  32. -t, --time=DURATION play only for DURATION (HH:MM:SS.DDD)
  33. -z, --shuffle randomize file list
  34. -r, --repeat[=MAX] play files MAX times, or indefinitely
  35. --tty-control enable keyboard controls
  36. --no-tty-control disable keyboard controls
  37. Miscellaneous:
  38. -T, --show-tags-only show ID3/encoder tags only (do not decode)
  39. -V, --version display version number and exit
  40. --license show copyright/license message and exit
  41. -h, --help display this help and exit
  42. Supported output formats:
  43. cdda CD audio, 16-bit big-endian 44100 Hz stereo PCM (*.cdr, *.cda)
  44. aiff Audio IFF, [16-bit] PCM (*.aif, *.aiff)
  45. wave Microsoft RIFF/WAVE, [16-bit] PCM (*.wav)
  46. snd Sun/NeXT audio, 8-bit ISDN mu-law (*.au, *.snd)
  47. raw binary [16-bit] host-endian linear PCM
  48. hex ASCII hexadecimal [24-bit] linear PCM
  49. null no output (decode only)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57

2.17.1 C调用函数

参考文档:http://blog.csdn.net/zouzuohuo/article/details/7895917

  1. system("madplay north.mp3 &");//利用system函数调用madplay播放器播放*.mp3音乐
  2. system("madplay north.mp3 -r &");//循环播放:参数-r
  3. system("killall -9 madplay");//利用system函数调用killall命令将madplay终止掉
  4. system("killall -STOP madplay &");//利用system函数调用killall命令将madplay暂停
  5. system("killall -CONT madplay &");//利用system函数调用killall命令恢复madplay的播放
  6. killall -19 madplay"使进程挂起以暂停
  7. killall -18 madplay"使进程恢复运行
  8. killall -9 madplay"终止进程以停止。
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

2.17.2 madplay 播放网路音频

参考文档:https://wiki.openwrt.org/toh/freecom/fsg-3?s[]=madplay

  1. cd /tmp
  2. wget http://icy-e-bz-05-cr.sharp-stream.com/magic1054.mp3 -O - | madplay
  3. wget -O - http://u11aw.di.fm:80/di_goapsy | madplay -
  4. wget -O - http://mp3stream1.apasf.apa.at:8000/ | madplay -
  5. wget -O - http://hirschmilch.de:7000/psytrance.mp3 | madplay -
  6. wget -O - http://64.236.34.97:80/stream/1014 | madplay -
  7. $ wget–q–O– http://my_music.com/mystream | madplay -Q --no-tty-control- $ wget–q–O– http://my_music.com/mystream | madplay -Q --no-tty-control- $ wget–q–O– http://my_music.com/mystream | madplay -Q --no-tty-control- $ wget–q–O– http://my_music.com/mystream | madplay -Q --no-tty-control-
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

2.17.3 显示剩余时间

  1. madplay -v --display-time=remaining 001.mp3
  2. madplay -v --display-time=current /tmp/mounts/USB-A1/music/*.mp3
  3. madplay -v /tmp/mounts/USB-A1/music/*.mp3
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

2.17.4 -o 将mp3转换成一个wav文件

  1. $madplay /Media/SD-P1/moh/*.mp3 -o /tmp/tmp.wav
  2. $madplay /Media/SD-P1/moh/*.mp3 -o /tmp/tmp.wav |aplay
  3. | madplay - &
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4

2.17.5 根据文件进行音乐播放

  1. http://www.epdoc.cn/qrs/18100.html
  2. root@mylinkit:/tmp# find /Media/SD-P1/moh/ -name "*.mp3" | sort >mp3.list
  3. root@mylinkit:/tmp# more mp3.list
  4. /Media/SD-P1/moh/001.mp3
  5. /Media/SD-P1/moh/002.mp3
  6. /Media/SD-P1/moh/003.mp3
  7. /Media/SD-P1/moh/001.mp3
  8. /Media/SD-P1/moh/002.mp3
  9. /Media/SD-P1/moh/003.mp3
  10. /Media/SD-P1/moh/004.mp3
  11. /Media/SD-P1/moh/005.mp3
  12. /Media/SD-P1/moh/006.mp3
  13. root@mylinkit:/tmp# madplay $(more mp3.list )
  14. example code:
  15. echo "sort the mp3 file and generate a mp3 list"
  16. find ./ -name "*.mp3"|sort>mp3.list
  17. /bin/echo "mp3.list:"
  18. more/mp3.list
  19. /bin/echo
  20. /bin/echo
  21. /bin/madplay$(more /mp3.list)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

2.17.6 madplay管道控制方式 FIFO

参考文档:https://www.cs.sfu.ca/CourseCentral/433/bfraser/other/2011-student-howtos/MadplayControlViaButtons.pdf

2.17.7 madplay音量控制

获得喇叭的最大音量/最小音量/当前音量,运算后保存回去。

  1. MIN_VOLUME=$(amixer cget numid=11,iface=MIXER,name='Speaker Playback Volume' | grep '; type' |sed 's/^.*min=//g' | sed 's/,.*$//g')
  2. MAX_VOLUME=$(amixer cget numid=11,iface=MIXER,name='Speaker Playback Volume' | grep '; type' |sed 's/^.*max=//g' | sed 's/,.*$//g')
  3. ALSA_VOLUME=$(amixer cget numid=11,iface=MIXER,name='Speaker Playback Volume' | grep ': values' |sed 's/^.*values=//g' | sed 's/,.*$//g')
  4. let MAX_VOLUME-=8
  5. if [ "$ALSA_VOLUME" -le "$MAX_VOLUME" ]
  6. then
  7. let ALSA_VOLUME+=8
  8. fi
  9. #echo $ALSA_VOLUME >/dev/console; echo $MAX_VOLUME >/dev/console
  10. amixer cset numid=11,iface=MIXER,name='Speaker Playback Volume' $ALSA_VOLUME
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

2.17.8 参考文档:

讲解如何用按键控制madplay 
http://wenku.baidu.com/link?url=aSt7QMxrFFHZngf7rN2lZu2R8tldvJdXnRSl93SCf1xldTvVFfQ_77dsWF3-nb9gYa3_LBDmJXTNLQQR09rCuUT-ycWgL-Z7V-BG3EH7fKW

Openwrt下 mplayer的配置详解 
http://www.crystalradio.cn/thread-466848-1-1.html

mp3播放器控制程序 
http://blog.sina.com.cn/s/blog_95268f5001016gnf.html

http://blog.csdn.net/zouzuohuo/article/details/7895917

2.18 swconfig

列出当前系统的存在的switch

  1. root@ipRec:/etc/config# swconfig list
  2. Found: switch0 - rt305x
  • 1
  • 2
  • 1
  • 2
  • 1
  • 2

展示当前switch端口配置

  1. root@ipRec:/etc/config# swconfig dev rt305x show
  2. Global attributes:
  3. enable_vlan: 0
  4. alternate_vlan_disable: 0
  5. bc_storm_protect: 0
  6. led_frequency: 0
  7. Port 0:
  8. disable: 0
  9. doubletag: 1
  10. untag: 1
  11. led: 5
  12. lan: 1
  13. recv_bad: 0
  14. recv_good: 2479
  15. tr_bad: 0
  16. tr_good: 104
  17. pvid: 0
  18. link: port:0 link:up speed:100baseT full-duplex
  19. Port 1:
  20. disable: 0
  21. doubletag: 1
  22. untag: 1
  23. led: 5
  24. lan: 1
  25. recv_bad: 0
  26. recv_good: 0
  27. tr_bad: 0
  28. tr_good: 0
  29. pvid: 0
  30. link: port:1 link:down
  31. Port 2:
  32. disable: 0
  33. doubletag: 1
  34. untag: 1
  35. led: 5
  36. lan: 1
  37. recv_bad: 0
  38. recv_good: 0
  39. tr_bad: 0
  40. tr_good: 0
  41. pvid: 0
  42. link: port:2 link:down
  43. Port 3:
  44. disable: 0
  45. doubletag: 1
  46. untag: 1
  47. led: 5
  48. lan: 1
  49. recv_bad: 0
  50. recv_good: 0
  51. tr_bad: 0
  52. tr_good: 0
  53. pvid: 0
  54. link: port:3 link:down
  55. Port 4:
  56. disable: 0
  57. doubletag: 1
  58. untag: 1
  59. led: 5
  60. lan: 1
  61. recv_bad: 0
  62. recv_good: 0
  63. tr_bad: 0
  64. tr_good: 0
  65. pvid: 0
  66. link: port:4 link:down
  67. Port 5:
  68. disable: 1
  69. doubletag: 1
  70. untag: 1
  71. led: ???
  72. lan: 1
  73. recv_bad: 0
  74. recv_good: 0
  75. tr_bad: 0
  76. tr_good: 0
  77. pvid: 0
  78. link: port:5 link:down
  79. Port 6:
  80. disable: 0
  81. doubletag: 1
  82. untag: 1
  83. led: ???
  84. lan: ???
  85. recv_bad: ???
  86. recv_good: ???
  87. tr_bad: ???
  88. tr_good: ???
  89. pvid: 0
  90. link: port:6 link:up speed:1000baseT full-duplex
  91. VLAN 0:
  92. ports: 0 1 2 3 4 5 6
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  1. root@ipRec:/etc/config# ifconfig
  2. br-lan Link encap:Ethernet HWaddr 00:0C:43:E1:76:2A
  3. inet addr:192.168.100.1 Bcast:192.168.100.255 Mask:255.255.255.0
  4. inet6 addr: fe80::20c:43ff:fee1:762a/64 Scope:Link
  5. inet6 addr: fd83:d6c:cf85::1/60 Scope:Global
  6. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  7. RX packets:903 errors:0 dropped:0 overruns:0 frame:0
  8. TX packets:306 errors:0 dropped:0 overruns:0 carrier:0
  9. collisions:0 txqueuelen:0
  10. RX bytes:63543 (62.0 KiB) TX bytes:27616 (26.9 KiB)
  11. eth0 Link encap:Ethernet HWaddr 00:0C:43:E1:76:29
  12. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  13. RX packets:1130 errors:0 dropped:0 overruns:0 frame:0
  14. TX packets:132 errors:0 dropped:0 overruns:0 carrier:0
  15. collisions:0 txqueuelen:1000
  16. RX bytes:124403 (121.4 KiB) TX bytes:11965 (11.6 KiB)
  17. Interrupt:5
  18. eth0.1 Link encap:Ethernet HWaddr 00:0C:43:E1:76:29
  19. inet6 addr: fe80::20c:43ff:fee1:7629/64 Scope:Link
  20. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  21. RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  22. TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
  23. collisions:0 txqueuelen:0
  24. RX bytes:0 (0.0 B) TX bytes:1931 (1.8 KiB)
  25. lo Link encap:Local Loopback
  26. inet addr:127.0.0.1 Mask:255.0.0.0
  27. inet6 addr: ::1/128 Scope:Host
  28. UP LOOPBACK RUNNING MTU:65536 Metric:1
  29. RX packets:8736 errors:0 dropped:0 overruns:0 frame:0
  30. TX packets:8736 errors:0 dropped:0 overruns:0 carrier:0
  31. collisions:0 txqueuelen:0
  32. RX bytes:594720 (580.7 KiB) TX bytes:594720 (580.7 KiB)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36

2.19 网络配置

http://labs.mediatek.com/site/global/developer_tools/mediatek_linkit_smart_7688/training_docs/network/setup_wireless_router/index.gsp

2.20 gpio debug

可以通过#cat /sys/kernel/debug/gpio命令查询当前按钮状态。lo,低电平,hi为高电平。

  1. root@mylinkit:/# cat /sys/kernel/debug/gpio
  2. GPIOs 0-31, platform/10000600.gpio, 10000600.gpio:
  3. gpio-11 (bootstrap ) out lo
  4. gpio-14 (BTN_0 ) in hi
  5. gpio-15 (BTN_1 ) in hi
  6. gpio-16 (BTN_2 ) in hi
  7. gpio-17 (BNT_3 ) in hi
  8. gpio-18 (BTN_4 ) in hi
  9. gpio-19 (S9 ) in hi
  10. GPIOs 32-63, platform/10000600.gpio, 10000600.gpio:
  11. gpio-38 (reset ) in hi
  12. GPIOs 64-95, platform/10000600.gpio, 10000600.gpio:
  13. GPIOs 127-127, platform/gpio-wifi, gpio-wifi:
  14. gpio-127 (mediatek:orange:wifi) out ?
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
2.21 环境变量显示

环境变量的相关信息,参考linux鸟歌私房菜上,P304。

2.22 稍描wifi热点

# iwinfo ra0 scan 
# time iwlist wlan0 scan | grep ESSID

  1. root@mylinkit:/tmp# iwinfo ra0 scan
  2. Cell 01 - Address: 6C:E8:73:AB:0C:96
  3. ESSID: "FAST_AB0C96"
  4. Mode: Master Channel: 1
  5. Signal: -256 dBm Quality: 10/100
  6. Encryption: WPA2 PSK (AES-OCB)
  7. Cell 02 - Address: C8:3A:35:29:F5:54
  8. ESSID: "wanghf"
  9. Mode: Master Channel: 1
  10. Signal: -256 dBm Quality: 7/100
  11. Encryption: WPA PSK (AES-OCB)
  12. Cell 03 - Address: 00:06:25:00:6E:72
  13. ESSID: "home"
  14. Mode: Master Channel: 6
  15. Signal: -256 dBm Quality: 81/100
  16. Encryption: WPA2 PSK (TKIP, AES-OCB)
  17. Cell 04 - Address: 8C:21:0A:41:D3:64
  18. ESSID: "wf"
  19. Mode: Master Channel: 11
  20. Signal: -256 dBm Quality: 0/100
  21. Encryption: WPA2 PSK (AES-OCB)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
2.23 du 查询磁盘空间使用情况

du /

2.24 PID查询命令ps, pidof, pgrep
2.25 date

http://www.runoob.com/linux/linux-comm-date.html 
http://www.2cto.com/os/201310/248416.html 
http://www.firefoxbug.com/index.php/archives/2799/ 
http://www.cnblogs.com/peida/archive/2012/12/13/2815687.html

date +%Y/%m/%d 
date +%H:%M

+%Y - year年 
+%m - month月 
+%d - day天 
+%H - Hour时 
+%M - Minute分 
+%S - Second秒 
+%s - 从 1970 年 1 月 1 日 00:00:00 UTC 到目前为止的秒数 
%H : 小时(00..23) 
%I : 小时(01..12) 
%k : 小时(0..23) 
%l : 小时(1..12) 
%M : 分钟(00..59) 
%p : 显示本地 AM 或 PM 
%r : 直接显示时间 (12 小时制,格式为 hh:mm:ss [AP]M) 
%s : 从 1970 年 1 月 1 日 00:00:00 UTC 到目前为止的秒数 
%S : 秒(00..61) 
%T : 直接显示时间 (24 小时制) 
%X : 相当于 %H:%M:%S 
%Z : 显示时区 %a : 星期几 (Sun..Sat) 
%A : 星期几 (Sunday..Saturday) 
%b : 月份 (Jan..Dec) 
%B : 月份 (January..December) 
%c : 直接显示日期与时间 
%d : 日 (01..31) 
%D : 直接显示日期 (mm/dd/yy) 
%h : 同 %b 
%j : 一年中的第几天 (001..366) 
%m : 月份 (01..12) 
%U : 一年中的第几周 (00..53) (以 Sunday 为一周的第一天的情形) 
%w : 一周中的第几天 (0..6) 
%W : 一年中的第几周 (00..53) (以 Monday 为一周的第一天的情形) 
%x : 直接显示日期 (mm/dd/yy) 
%y : 年份的最后两位数字 (00.99) 
%Y : 完整年份 (0000..9999)

date指定格式输出 
$ date +”%Y-%m-%d %H:%M:%S” 
2014-11-21 23:59:37

转换指定日期为Unix时间戳: 
$ date -d “2008-01-01 00:00:00” +%s 
1199116800

  1. $ date -d 2008-01-01 +%s
  2. 1199116800
  3. $ date -d 20080101 +%s
  4. 1199116800
  5. 例外: 有一种场景date格式是连续的(没找到date命令怎么转换成unix)
  6. $ echo 20080101010101 | awk '{print substr($0,1,4)"-"substr($0,5,2)"-"substr($0,7,2)" "substr($0,9,2)":"substr($0,11,2)":"substr($0,13,2) }'
  7. 2008-01-01 01:01:01
  8. $ date -d "2008-01-01 01:01:01" +%s
  9. 1199120461
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

root@mylinkit:/etc/config# date -help 
date: invalid option – h 
BusyBox v1.23.2 (2016-01-20 23:54:03 CST) multi-call binary.

Usage: date [OPTIONS] [+FMT] [TIME]

Display time (using +FMT), or set time

  1. [-s,--set] TIME Set time to TIME
  2. -u,--utc Work in UTC (don't convert to local time)
  3. -R,--rfc-2822 Output RFC-2822 compliant date string
  4. -I[SPEC] Output ISO-8601 compliant date string
  5. SPEC='date' (default) for date only,
  6. 'hours', 'minutes', or 'seconds' for date and
  7. time to the indicated precision
  8. -r,--reference FILE Display last modification time of FILE
  9. -d,--date TIME Display TIME, not 'now'
  10. -D FMT Use FMT for -d TIME conversion
  11. -k Set Kernel timezone from localtime and exit
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

Recognized TIME formats: 
hh:mm[:ss] 
[YYYY.]MM.DD-hh:mm[:ss] 
YYYY-MM-DD hh:mm[:ss] 
[[[[[YY]YY]MM]DD]hh]mm[.ss]

2.26 grep,sed,cut

参考moh-scheduler文档

  1. # SD10022016&ED31012016&DW1111100&TS1015TE1730
  2. start_day=$(cat $config_file |sed 's/^.*SD//g'|cut -c -8)
  3. cut切除指定的字符
  4. cut -c 1-8 //切除第1到第8字符
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
2.27 wait

https://zh.wikipedia.org/wiki/Wait_(%E5%91%BD%E4%BB%A4)

2.28 ubus
  1. root@mylinkit:~# ubus --help
  2. ubus: invalid option -- -
  3. Usage: ubus [<options>] <command> [arguments...]
  4. Options:
  5. -s <socket>: Set the unix domain socket to connect to
  6. -t <timeout>: Set the timeout (in seconds) for a command to complete
  7. -S: Use simplified output (for scripts)
  8. -v: More verbose output
  9. Commands:
  10. - list [<path>] List objects
  11. - call <path> <method> [<message>] Call an object method
  12. - listen [<path>...] Listen for events
  13. - send <type> [<message>] Send an event
  14. - wait_for <object> [<object>...] Wait for multiple objects to appear on ubus
  15. root@mylinkit:~# ubus list
  16. dhcp
  17. iwinfo
  18. log
  19. network
  20. network.device
  21. network.interface
  22. network.interface.lan
  23. network.interface.loopback
  24. network.interface.wan
  25. network.wireless
  26. rpc-sys
  27. service
  28. session
  29. system
  30. uci
  31. root@mylinkit:~# ubus list -v
  32. 'dhcp' @d5aa2d81
  33. "ipv4leases":{}
  34. "ipv6leases":{}
  35. 'iwinfo' @804494b9
  36. "devices":{}
  37. "info":{"device":"String"}
  38. "scan":{"device":"String"}
  39. "assoclist":{"device":"String","mac":"String"}
  40. "freqlist":{"device":"String"}
  41. "txpowerlist":{"device":"String"}
  42. "countrylist":{"device":"String"}
  43. "phyname":{"section":"String"}
  44. 'log' @e7e97da6
  45. "read":{"lines":"Integer"}
  46. "write":{"event":"String"}
  47. 'network' @06d3dcba
  48. "restart":{}
  49. "reload":{}
  50. "add_host_route":{"target":"String","v6":"Boolean","interface":"String"}
  51. "get_proto_handlers":{}
  52. "add_dynamic":{"name":"String"}
  53. 'network.device' @9b47eb98
  54. "status":{"name":"String"}
  55. "set_alias":{"alias":"Array","device":"String"}
  56. "set_state":{"name":"String","defer":"Boolean"}
  57. 'network.interface' @c806e5d7
  58. "up":{}
  59. "down":{}
  60. "status":{}
  61. "prepare":{}
  62. "dump":{}
  63. "add_device":{"name":"String","link-ext":"Boolean"}
  64. "remove_device":{"name":"String","link-ext":"Boolean"}
  65. "notify_proto":{}
  66. "remove":{}
  67. "set_data":{}
  68. 'network.interface.lan' @da711a3b
  69. "up":{}
  70. "down":{}
  71. "status":{}
  72. "prepare":{}
  73. "dump":{}
  74. "add_device":{"name":"String","link-ext":"Boolean"}
  75. "remove_device":{"name":"String","link-ext":"Boolean"}
  76. "notify_proto":{}
  77. "remove":{}
  78. "set_data":{}
  79. 'network.interface.loopback' @eaf974e8
  80. "up":{}
  81. "down":{}
  82. "status":{}
  83. "prepare":{}
  84. "dump":{}
  85. "add_device":{"name":"String","link-ext":"Boolean"}
  86. "remove_device":{"name":"String","link-ext":"Boolean"}
  87. "notify_proto":{}
  88. "remove":{}
  89. "set_data":{}
  90. 'network.interface.wan' @eff0e141
  91. "up":{}
  92. "down":{}
  93. "status":{}
  94. "prepare":{}
  95. "dump":{}
  96. "add_device":{"name":"String","link-ext":"Boolean"}
  97. "remove_device":{"name":"String","link-ext":"Boolean"}
  98. "notify_proto":{}
  99. "remove":{}
  100. "set_data":{}
  101. 'network.wireless' @a8161143
  102. "up":{}
  103. "down":{}
  104. "status":{}
  105. "notify":{}
  106. "get_validate":{}
  107. 'rpc-sys' @dd844b8f
  108. "password_set":{"user":"String","password":"String"}
  109. "upgrade_test":{}
  110. "upgrade_start":{"keep":"Boolean"}
  111. "upgrade_clean":{}
  112. "factory":{}
  113. "reboot":{}
  114. 'service' @1312b281
  115. "set":{"name":"String","script":"String","instances":"Table","triggers":"Array","validate":"Array"}
  116. "add":{"name":"String","script":"String","instances":"Table","triggers":"Array","validate":"Array"}
  117. "list":{"name":"String","verbose":"Boolean"}
  118. "delete":{"name":"String","instance":"String"}
  119. "update_start":{"name":"String"}
  120. "update_complete":{"name":"String"}
  121. "event":{"type":"String","data":"Table"}
  122. "validate":{"package":"String","type":"String","service":"String"}
  123. "get_data":{"name":"String","instance":"String","type":"String"}
  124. 'session' @4417ac78
  125. "create":{"timeout":"Integer"}
  126. "list":{"ubus_rpc_session":"String"}
  127. "grant":{"ubus_rpc_session":"String","scope":"String","objects":"Array"}
  128. "revoke":{"ubus_rpc_session":"String","scope":"String","objects":"Array"}
  129. "access":{"ubus_rpc_session":"String","scope":"String","object":"String","function":"String"}
  130. "set":{"ubus_rpc_session":"String","values":"Table"}
  131. "get":{"ubus_rpc_session":"String","keys":"Array"}
  132. "unset":{"ubus_rpc_session":"String","keys":"Array"}
  133. "destroy":{"ubus_rpc_session":"String"}
  134. "login":{"username":"String","password":"String","timeout":"Integer"}
  135. 'system' @5bc7fd25
  136. "board":{}
  137. "info":{}
  138. "upgrade":{}
  139. "watchdog":{"frequency":"Integer","timeout":"Integer","stop":"Boolean"}
  140. "signal":{"pid":"Integer","signum":"Integer"}
  141. "nandupgrade":{"path":"String"}
  142. 'uci' @2fd66254
  143. "configs":{}
  144. "get":{"config":"String","section":"String","option":"String","type":"String","match":"Table","ubus_rpc_session":"String"}
  145. "state":{"config":"String","section":"String","option":"String","type":"String","match":"Table","ubus_rpc_session":"String"}
  146. "add":{"config":"String","type":"String","name":"String","values":"Table","ubus_rpc_session":"String"}
  147. "set":{"config":"String","section":"String","type":"String","match":"Table","values":"Table","ubus_rpc_session":"String"}
  148. "delete":{"config":"String","section":"String","type":"String","match":"Table","option":"String","options":"Array","ubus_rpc_session":"String"}
  149. "rename":{"config":"String","section":"String","option":"String","name":"String","ubus_rpc_session":"String"}
  150. "order":{"config":"String","sections":"Array","ubus_rpc_session":"String"}
  151. "changes":{"config":"String","ubus_rpc_session":"String"}
  152. "revert":{"config":"String","ubus_rpc_session":"String"}
  153. "commit":{"config":"String","ubus_rpc_session":"String"}
  154. "apply":{"rollback":"Boolean","timeout":"Integer","ubus_rpc_session":"String"}
  155. "confirm":{"ubus_rpc_session":"String"}
  156. "rollback":{"ubus_rpc_session":"String"}
  157. "reload_config":{}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161

3. openwrt application

3.1 opkg
3.2 date
  1. root@mylinkit:/etc/config# date -help
  2. date: invalid option -- h
  3. BusyBox v1.23.2 (2016-01-20 23:54:03 CST) multi-call binary.
  4. Usage: date [OPTIONS] [+FMT] [TIME]
  5. Display time (using +FMT), or set time
  6. [-s,--set] TIME Set time to TIME
  7. -u,--utc Work in UTC (don't convert to local time)
  8. -R,--rfc-2822 Output RFC-2822 compliant date string
  9. -I[SPEC] Output ISO-8601 compliant date string
  10. SPEC='date' (default) for date only,
  11. 'hours', 'minutes', or 'seconds' for date and
  12. time to the indicated precision
  13. -r,--reference FILE Display last modification time of FILE
  14. -d,--date TIME Display TIME, not 'now'
  15. -D FMT Use FMT for -d TIME conversion
  16. -k Set Kernel timezone from localtime and exit
  17. Recognized TIME formats:
  18. hh:mm[:ss]
  19. [YYYY.]MM.DD-hh:mm[:ss]
  20. YYYY-MM-DD hh:mm[:ss]
  21. [[[[[YY]YY]MM]DD]hh]mm[.ss]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
3.3 稍描wifi热点
  1. # iwinfo ra0 scan
  2. # time iwlist wlan0 scan | grep ESSID
  3. root@mylinkit:/tmp# iwinfo ra0 scan
  4. Cell 01 - Address: 6C:E8:73:AB:0C:96
  5. ESSID: "FAST_AB0C96"
  6. Mode: Master Channel: 1
  7. Signal: -256 dBm Quality: 10/100
  8. Encryption: WPA2 PSK (AES-OCB)
  9. Cell 02 - Address: C8:3A:35:29:F5:54
  10. ESSID: "wanghf"
  11. Mode: Master Channel: 1
  12. Signal: -256 dBm Quality: 7/100
  13. Encryption: WPA PSK (AES-OCB)
  14. Cell 03 - Address: 00:06:25:00:6E:72
  15. ESSID: "home"
  16. Mode: Master Channel: 6
  17. Signal: -256 dBm Quality: 81/100
  18. Encryption: WPA2 PSK (TKIP, AES-OCB)
  19. Cell 04 - Address: 8C:21:0A:41:D3:64
  20. ESSID: "wf"
  21. Mode: Master Channel: 11
  22. Signal: -256 dBm Quality: 0/100
  23. Encryption: WPA2 PSK (AES-OCB)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
3.4 alsamixer,amixer 音量调节
  • alsamixer是文本方式下的图形命令
  • amixer是文本方式下的文本命令

amixer

  1. Simple mixer control 'Headphone',0
  2. Capabilities: pvolume
  3. Playback channels: Front Left - Front Right
  4. Limits: Playback 0 - 127
  5. Mono:
  6. Front Left: Playback 121 [95%] [0.00dB]
  7. Front Right: Playback 121 [95%] [0.00dB]
  8. Simple mixer control 'Headphone Playback ZC',0
  9. Capabilities: pswitch
  10. Playback channels: Front Left - Front Right
  11. Mono:
  12. Front Left: Playback [on]
  13. Front Right: Playback [on]
  14. Simple mixer control 'Speaker',0
  15. Capabilities: pvolume
  16. Playback channels: Front Left - Front Right
  17. Limits: Playback 0 - 127
  18. Mono:
  19. Front Left: Playback 121 [95%] [0.00dB]
  20. Front Right: Playback 121 [95%] [0.00dB]
  21. Simple mixer control 'Speaker AC',0
  22. Capabilities: volume volume-joined
  23. Playback channels: Mono
  24. Capture channels: Mono
  25. Limits: 0 - 5
  26. Mono: 4 [80%]
  27. Simple mixer control 'Speaker DC',0
  28. Capabilities: volume volume-joined
  29. Playback channels: Mono
  30. Capture channels: Mono
  31. Limits: 0 - 5
  32. Mono: 5 [100%]
  33. Simple mixer control 'Speaker Playback ZC',0
  34. Capabilities: pswitch
  35. Playback channels: Front Left - Front Right
  36. Mono:
  37. Front Left: Playback [off]
  38. Front Right: Playback [off]
  39. Simple mixer control 'PCM Playback -6dB',0
  40. Capabilities: pswitch pswitch-joined
  41. Playback channels: Mono
  42. Mono: Playback [off]
  43. Simple mixer control 'Mono Output Mixer Left',0
  44. Capabilities: pswitch pswitch-joined
  45. Playback channels: Mono
  46. Mono: Playback [on]
  47. Simple mixer control 'Mono Output Mixer Right',0
  48. Capabilities: pswitch pswitch-joined
  49. Playback channels: Mono
  50. Mono: Playback [on]
  51. Simple mixer control 'Playback',0
  52. Capabilities: volume
  53. Playback channels: Front Left - Front Right
  54. Capture channels: Front Left - Front Right
  55. Limits: 0 - 255
  56. Front Left: 243 [95%] [-5.50dB]
  57. Front Right: 243 [95%] [-5.50dB]
  58. Simple mixer control 'Capture',0
  59. Capabilities: cvolume cswitch
  60. Capture channels: Front Left - Front Right
  61. Limits: Capture 0 - 63
  62. Front Left: Capture 43 [68%] [-75.50dB] [off]
  63. Front Right: Capture 43 [68%] [-75.50dB] [off]
  64. Simple mixer control '3D',0
  65. Capabilities: volume volume-joined pswitch pswitch-joined
  66. Playback channels: Mono
  67. Capture channels: Mono
  68. Limits: 0 - 15
  69. Mono: 0 [0%] Playback [off]
  70. Simple mixer control '3D Filter Lower Cut-Off',0
  71. Capabilities: enum
  72. Items: 'Low' 'High'
  73. Item0: 'Low'
  74. Simple mixer control '3D Filter Upper Cut-Off',0
  75. Capabilities: enum
  76. Items: 'High' 'Low'
  77. Item0: 'High'
  78. Simple mixer control 'ADC High Pass Filter',0
  79. Capabilities: pswitch pswitch-joined
  80. Playback channels: Mono
  81. Mono: Playback [off]
  82. Simple mixer control 'ADC PCM',0
  83. Capabilities: cvolume
  84. Capture channels: Front Left - Front Right
  85. Limits: Capture 0 - 255
  86. Front Left: Capture 206 [81%] [6.00dB]
  87. Front Right: Capture 206 [81%] [6.00dB]
  88. Simple mixer control 'ADC Polarity',0
  89. Capabilities: enum
  90. Items: 'No Inversion' 'Left Inverted' 'Right Inverted' 'Stereo Inversion'
  91. Item0: 'No Inversion'
  92. Simple mixer control 'ALC Attack',0
  93. Capabilities: volume volume-joined
  94. Playback channels: Mono
  95. Capture channels: Mono
  96. Limits: 0 - 15
  97. Mono: 2 [13%]
  98. Simple mixer control 'ALC Decay',0
  99. Capabilities: volume volume-joined
  100. Playback channels: Mono
  101. Capture channels: Mono
  102. Limits: 0 - 15
  103. Mono: 3 [20%]
  104. Simple mixer control 'ALC Function',0
  105. Capabilities: enum
  106. Items: 'Off' 'Right' 'Left' 'Stereo'
  107. Item0: 'Off'
  108. Simple mixer control 'ALC Hold Time',0
  109. Capabilities: volume volume-joined
  110. Playback channels: Mono
  111. Capture channels: Mono
  112. Limits: 0 - 15
  113. Mono: 0 [0%]
  114. Simple mixer control 'ALC Max Gain',0
  115. Capabilities: volume volume-joined
  116. Playback channels: Mono
  117. Capture channels: Mono
  118. Limits: 0 - 7
  119. Mono: 7 [100%]
  120. Simple mixer control 'ALC Min Gain',0
  121. Capabilities: volume volume-joined
  122. Playback channels: Mono
  123. Capture channels: Mono
  124. Limits: 0 - 7
  125. Mono: 0 [0%]
  126. Simple mixer control 'ALC Mode',0
  127. Capabilities: enum
  128. Items: 'ALC' 'Limiter'
  129. Item0: 'ALC'
  130. Simple mixer control 'ALC Target',0
  131. Capabilities: volume volume-joined
  132. Playback channels: Mono
  133. Capture channels: Mono
  134. Limits: 0 - 15
  135. Mono: 4 [27%]
  136. Simple mixer control 'DAC Deemphasis',0
  137. Capabilities: pswitch pswitch-joined
  138. Playback channels: Mono
  139. Mono: Playback [off]
  140. Simple mixer control 'DAC Polarity',0
  141. Capabilities: enum
  142. Items: 'No Inversion' 'Left Inverted' 'Right Inverted' 'Stereo Inversion'
  143. Item0: 'No Inversion'
  144. Simple mixer control 'Left Boost Mixer LINPUT1',0
  145. Capabilities: pswitch pswitch-joined
  146. Playback channels: Mono
  147. Mono: Playback [on]
  148. Simple mixer control 'Left Boost Mixer LINPUT2',0
  149. Capabilities: pswitch pswitch-joined
  150. Playback channels: Mono
  151. Mono: Playback [on]
  152. Simple mixer control 'Left Boost Mixer LINPUT3',0
  153. Capabilities: pswitch pswitch-joined
  154. Playback channels: Mono
  155. Mono: Playback [off]
  156. Simple mixer control 'Left Input Boost Mixer LINPUT2',0
  157. Capabilities: volume volume-joined
  158. Playback channels: Mono
  159. Capture channels: Mono
  160. Limits: 0 - 7
  161. Mono: 0 [0%] [-99999.99dB]
  162. Simple mixer control 'Left Input Boost Mixer LINPUT3',0
  163. Capabilities: volume volume-joined
  164. Playback channels: Mono
  165. Capture channels: Mono
  166. Limits: 0 - 7
  167. Mono: 0 [0%] [-99999.99dB]
  168. Simple mixer control 'Left Input Mixer Boost',0
  169. Capabilities: pswitch pswitch-joined
  170. Playback channels: Mono
  171. Mono: Playback [on]
  172. Simple mixer control 'Left Output Mixer Boost Bypass',0
  173. Capabilities: volume volume-joined pswitch pswitch-joined
  174. Playback channels: Mono
  175. Capture channels: Mono
  176. Limits: 0 - 7
  177. Mono: 2 [29%] [-15.00dB] Playback [off]
  178. Simple mixer control 'Left Output Mixer LINPUT3',0
  179. Capabilities: volume volume-joined pswitch pswitch-joined
  180. Playback channels: Mono
  181. Capture channels: Mono
  182. Limits: 0 - 7
  183. Mono: 7 [100%] [0.00dB] Playback [off]
  184. Simple mixer control 'Left Output Mixer PCM',0
  185. Capabilities: pswitch pswitch-joined
  186. Playback channels: Mono
  187. Mono: Playback [on]
  188. Simple mixer control 'Noise Gate',0
  189. Capabilities: pswitch pswitch-joined
  190. Playback channels: Mono
  191. Mono: Playback [off]
  192. Simple mixer control 'Noise Gate Threshold',0
  193. Capabilities: volume volume-joined
  194. Playback channels: Mono
  195. Capture channels: Mono
  196. Limits: 0 - 31
  197. Mono: 0 [0%]
  198. Simple mixer control 'Right Boost Mixer RINPUT1',0
  199. Capabilities: pswitch pswitch-joined
  200. Playback channels: Mono
  201. Mono: Playback [on]
  202. Simple mixer control 'Right Boost Mixer RINPUT2',0
  203. Capabilities: pswitch pswitch-joined
  204. Playback channels: Mono
  205. Mono: Playback [on]
  206. Simple mixer control 'Right Boost Mixer RINPUT3',0
  207. Capabilities: pswitch pswitch-joined
  208. Playback channels: Mono
  209. Mono: Playback [off]
  210. Simple mixer control 'Right Input Boost Mixer RINPUT2',0
  211. Capabilities: volume volume-joined
  212. Playback channels: Mono
  213. Capture channels: Mono
  214. Limits: 0 - 7
  215. Mono: 0 [0%] [-99999.99dB]
  216. Simple mixer control 'Right Input Boost Mixer RINPUT3',0
  217. Capabilities: volume volume-joined
  218. Playback channels: Mono
  219. Capture channels: Mono
  220. Limits: 0 - 7
  221. Mono: 0 [0%] [-99999.99dB]
  222. Simple mixer control 'Right Input Mixer Boost',0
  223. Capabilities: pswitch pswitch-joined
  224. Playback channels: Mono
  225. Mono: Playback [on]
  226. Simple mixer control 'Right Output Mixer Boost Bypass',0
  227. Capabilities: volume volume-joined pswitch pswitch-joined
  228. Playback channels: Mono
  229. Capture channels: Mono
  230. Limits: 0 - 7
  231. Mono: 2 [29%] [-15.00dB] Playback [off]
  232. Simple mixer control 'Right Output Mixer PCM',0
  233. Capabilities: pswitch pswitch-joined
  234. Playback channels: Mono
  235. Mono: Playback [on]
  236. Simple mixer control 'Right Output Mixer RINPUT3',0
  237. Capabilities: volume volume-joined pswitch pswitch-joined
  238. Playback channels: Mono
  239. Capture channels: Mono
  240. Limits: 0 - 7
  241. Mono: 7 [100%] [0.00dB] Playback [off]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241

amixer controls

  1. numid=10,iface=MIXER,name='Headphone Playback ZC Switch'
  2. numid=9,iface=MIXER,name='Headphone Playback Volume'
  3. numid=15,iface=MIXER,name='PCM Playback -6dB Switch'
  4. numid=39,iface=MIXER,name='Mono Output Mixer Left Switch'
  5. numid=40,iface=MIXER,name='Mono Output Mixer Right Switch'
  6. numid=17,iface=MIXER,name='ADC High Pass Filter Switch'
  7. numid=34,iface=MIXER,name='ADC PCM Capture Volume'
  8. numid=16,iface=MIXER,name='ADC Polarity'
  9. numid=2,iface=MIXER,name='Capture Volume ZC Switch'
  10. numid=3,iface=MIXER,name='Capture Switch'
  11. numid=1,iface=MIXER,name='Capture Volume'
  12. numid=8,iface=MIXER,name='Playback Volume'
  13. numid=21,iface=MIXER,name='3D Filter Lower Cut-Off'
  14. numid=20,iface=MIXER,name='3D Filter Upper Cut-Off'
  15. numid=23,iface=MIXER,name='3D Switch'
  16. numid=22,iface=MIXER,name='3D Volume'
  17. numid=31,iface=MIXER,name='ALC Attack'
  18. numid=30,iface=MIXER,name='ALC Decay'
  19. numid=24,iface=MIXER,name='ALC Function'
  20. numid=28,iface=MIXER,name='ALC Hold Time'
  21. numid=25,iface=MIXER,name='ALC Max Gain'
  22. numid=27,iface=MIXER,name='ALC Min Gain'
  23. numid=29,iface=MIXER,name='ALC Mode'
  24. numid=26,iface=MIXER,name='ALC Target'
  25. numid=19,iface=MIXER,name='DAC Deemphasis Switch'
  26. numid=18,iface=MIXER,name='DAC Polarity'
  27. numid=54,iface=MIXER,name='Left Boost Mixer LINPUT1 Switch'
  28. numid=52,iface=MIXER,name='Left Boost Mixer LINPUT2 Switch'
  29. numid=53,iface=MIXER,name='Left Boost Mixer LINPUT3 Switch'
  30. numid=7,iface=MIXER,name='Left Input Boost Mixer LINPUT2 Volume'
  31. numid=6,iface=MIXER,name='Left Input Boost Mixer LINPUT3 Volume'
  32. numid=48,iface=MIXER,name='Left Input Mixer Boost Switch'
  33. numid=46,iface=MIXER,name='Left Output Mixer Boost Bypass Switch'
  34. numid=35,iface=MIXER,name='Left Output Mixer Boost Bypass Volume'
  35. numid=45,iface=MIXER,name='Left Output Mixer LINPUT3 Switch'
  36. numid=36,iface=MIXER,name='Left Output Mixer LINPUT3 Volume'
  37. numid=44,iface=MIXER,name='Left Output Mixer PCM Playback Switch'
  38. numid=33,iface=MIXER,name='Noise Gate Switch'
  39. numid=32,iface=MIXER,name='Noise Gate Threshold'
  40. numid=51,iface=MIXER,name='Right Boost Mixer RINPUT1 Switch'
  41. numid=49,iface=MIXER,name='Right Boost Mixer RINPUT2 Switch'
  42. numid=50,iface=MIXER,name='Right Boost Mixer RINPUT3 Switch'
  43. numid=5,iface=MIXER,name='Right Input Boost Mixer RINPUT2 Volume'
  44. numid=4,iface=MIXER,name='Right Input Boost Mixer RINPUT3 Volume'
  45. numid=47,iface=MIXER,name='Right Input Mixer Boost Switch'
  46. numid=43,iface=MIXER,name='Right Output Mixer Boost Bypass Switch'
  47. numid=37,iface=MIXER,name='Right Output Mixer Boost Bypass Volume'
  48. numid=41,iface=MIXER,name='Right Output Mixer PCM Playback Switch'
  49. numid=42,iface=MIXER,name='Right Output Mixer RINPUT3 Switch'
  50. numid=38,iface=MIXER,name='Right Output Mixer RINPUT3 Volume'
  51. numid=14,iface=MIXER,name='Speaker AC Volume'
  52. numid=13,iface=MIXER,name='Speaker DC Volume'
  53. numid=11,iface=MIXER,name='Speaker Playback Volume'
  54. numid=12,iface=MIXER,name='Speaker Playback ZC Switch'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  1. numid=8,iface=MIXER,name='Playback Volume'
  2. numid=9,iface=MIXER,name='Headphone Playback Volume'
  3. numid=11,iface=MIXER,name='Speaker Playback Volume'
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

sed参考文档:Linux鸟歌的私房菜 P359

获得当前喇叭音量值

# amixer cget numid=11,iface=MIXER,name='Speaker Playback Volume' | grep ': values' |sed 's/^.*values=//g' | sed 's/,.*$//g'
   
   
  • 1
  • 1
  • 1

获得耳机音量值

# amixer cget numid=9,iface=MIXER,name='Headphone Playback Volume' | grep ': values' |sed 's/^.*values=//g' | sed 's/,.*$//g'
   
   
  • 1
  • 1
  • 1

获得播放音量值

# amixer cget numid=8,iface=MIXER,name='Playback Volume' | grep ': values' |sed 's/^.*values=//g' | sed 's/,.*$//g'
   
   
  • 1
  • 1
  • 1
3.5 top
3.6 ps
  1. Mem: 41608K used, 84840K free, 320K shrd, 4332K buff, 11960K cached
  2. CPU: 0% usr 0% sys 0% nic 99% idle 0% io 0% irq 0% sirq
  3. Load average: 0.00 0.01 0.05 2/43 1864
  4. PID PPID USER STAT VSZ %VSZ %CPU COMMAND
  5. 1581 1191 root S 1240 1% 0% /usr/sbin/dropbear -F -P /var/run/dro
  6. 1331 1 root S 1016 1% 0% /sbin/mountd -f
  7. 1299 1 root S 3188 3% 0% /usr/sbin/nmbd -F
  8. 1298 1 root S 3096 2% 0% /usr/sbin/smbd -F
  9. 1088 1 root S 1824 1% 0% /sbin/rpcd
  10. 1306 1 nobody S 1768 1% 0% avahi-daemon: running [mylinkit.local
  11. 1267 1 root S 1640 1% 0% /usr/sbin/uhttpd -f -h /www -r mylink
  12. 1122 1 root S 1600 1% 0% /sbin/netifd
  13. 1582 1581 root S 1496 1% 0% -ash
  14. 1401 1 root S 1488 1% 0% /usr/sbin/ntpd -n -S /usr/sbin/ntpd-h
  15. 1602 1601 root S 1488 1% 0% -ash
  16. 1864 1582 root R 1488 1% 0% top
  17. 1504 1122 root S 1484 1% 0% udhcpc -p /var/run/udhcpc-apcli0.pid
  18. 1 0 root S 1436 1% 0% /sbin/procd
  19. 1601 1191 root S 1240 1% 0% /usr/sbin/dropbear -F -P /var/run/dro
  20. 1160 1 root S 1192 1% 0% /usr/sbin/odhcpd
  21. 1191 1 root S 1148 1% 0% /usr/sbin/dropbear -F -P /var/run/dro
  22. 1079 1 root S 1056 1% 0% /sbin/logd -S 16
  23. 1572 1 nobody S 992 1% 0% /usr/sbin/dnsmasq -C /var/etc/dnsmasq
  24. 430 1 root S 904 1% 0% /sbin/ubusd
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
3.7 iwpriv
  1. root@mylinkit:/tmp# iwpriv -help
  2. Usage: iwpriv interface [private-command [private-arguments]]
  • 1
  • 2
  • 1
  • 2
  • 1
  • 2
  1. root@mylinkit:/tmp# iwpriv
  2. eth0.1 no private ioctls.
  3. lo no private ioctls.
  4. ra0 Available private ioctls :
  5. set (8BE2) : set 1536 char & get 0
  6. show (8BF1) : set 1024 char & get 0
  7. get_site_survey (8BED) : set 0 & get 1024 char
  8. set_wsc_oob (8BF9) : set 1024 char & get 1024 char
  9. get_mac_table (8BEF) : set 1024 char & get 1024 char
  10. e2p (8BE7) : set 1024 char & get 1024 char
  11. bbp (8BE3) : set 1024 char & get 1024 char
  12. mac (8BE5) : set 1024 char & get 1024 char
  13. rf (8BF3) : set 1024 char & get 1024 char
  14. get_wsc_profile (8BF2) : set 1024 char & get 1024 char
  15. get_ba_table (8BF6) : set 1024 char & get 1024 char
  16. stat (8BE9) : set 1024 char & get 1024 char
  17. apcli1 Available private ioctls :
  18. set (8BE2) : set 1536 char & get 0
  19. show (8BF1) : set 1024 char & get 0
  20. get_site_survey (8BED) : set 0 & get 1024 char
  21. set_wsc_oob (8BF9) : set 1024 char & get 1024 char
  22. get_mac_table (8BEF) : set 1024 char & get 1024 char
  23. e2p (8BE7) : set 1024 char & get 1024 char
  24. bbp (8BE3) : set 1024 char & get 1024 char
  25. mac (8BE5) : set 1024 char & get 1024 char
  26. rf (8BF3) : set 1024 char & get 1024 char
  27. get_wsc_profile (8BF2) : set 1024 char & get 1024 char
  28. get_ba_table (8BF6) : set 1024 char & get 1024 char
  29. stat (8BE9) : set 1024 char & get 1024 char
  30. eth0 no private ioctls.
  31. apcli0 Available private ioctls :
  32. set (8BE2) : set 1536 char & get 0
  33. show (8BF1) : set 1024 char & get 0
  34. get_site_survey (8BED) : set 0 & get 1024 char
  35. set_wsc_oob (8BF9) : set 1024 char & get 1024 char
  36. get_mac_table (8BEF) : set 1024 char & get 1024 char
  37. e2p (8BE7) : set 1024 char & get 1024 char
  38. bbp (8BE3) : set 1024 char & get 1024 char
  39. mac (8BE5) : set 1024 char & get 1024 char
  40. rf (8BF3) : set 1024 char & get 1024 char
  41. get_wsc_profile (8BF2) : set 1024 char & get 1024 char
  42. get_ba_table (8BF6) : set 1024 char & get 1024 char
  43. stat (8BE9) : set 1024 char & get 1024 char
  44. br-lan no private ioctls.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50

/lib/netifd/wireless/ralink.sh 
* iwpriv ra0 
* set 
* Channel 
* NoForwarding 
* NoForwardingBTNBSSID 
* NoForwardingMBCast 
* HideSSID 
* RADIUS_Server 
* RADIUS_Port 
* RADIUS_Key 
* own_ip_addr 
* EAPifname 
* PreAuthIfname 
* AuthMode 
* EncrypType 
* IEEE8021X 
* “SSID={key} 
* DefaultKeyID=2 
* AuthMode=WEPAUTO 
* EncrypType=WEP 
* IEEE8021X=0 
* DefaultKeyID=wsc_mode 
* WscConfStatus=2 
* WscMode=2 
* ACLClearAll=1 
* ACLAddEntry=”$m” 
* AccessPolicy=0,1,2

# iwpriv ra0 set Channel=6
   
   
  • 1
  • 1
  • 1
3.8 miniDLNA

https://wiki.openwrt.org/doc/uci/minidlna 
https://github.com/xiongyihui/LinkIt_Smart_7688

Openwrt下安装miniDLNA

  1. root@OpenWrt:~# opkg update
  2. root@OpenWrt:~# opkg install minidlna
  • 1
  • 2
  • 1
  • 2
  • 1
  • 2
  1. root@mylinkit:~# opkg install minidlna
  2. Installing minidlna (1.1.4-2) to root...
  3. Downloading http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7688/packages/packages/minidlna_1.1.4-2_ramips_24kec.ipk.
  4. Installing libexif (0.6.21-1) to root...
  5. Downloading http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7688/packages/packages/libexif_0.6.21-1_ramips_24kec.ipk.
  6. Installing libffmpeg-mini (2.6.2-1) to root...
  7. Downloading http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7688/packages/packages/libffmpeg-mini_2.6.2-1_ramips_24kec.ipk.
  8. Installing libflac (1.3.1-1) to root...
  9. Downloading http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7688/packages/packages/libflac_1.3.1-1_ramips_24kec.ipk.
  10. Installing libvorbis (1.3.5-1) to root...
  11. Downloading http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7688/packages/packages/libvorbis_1.3.5-1_ramips_24kec.ipk.
  12. Installing libogg (1.3.2-2) to root...
  13. Downloading http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7688/packages/packages/libogg_1.3.2-2_ramips_24kec.ipk.
  14. Installing libuuid (2.25.2-4) to root...
  15. Downloading http://downloads.openwrt.org/chaos_calmer/15.05.1/ramips/mt7688/packages/base/libuuid_2.25.2-4_ramips_24kec.ipk.
  16. Configuring libogg.
  17. Configuring libexif.
  18. Configuring libflac.
  19. Configuring libvorbis.
  20. Configuring libuuid.
  21. Configuring libffmpeg-mini.
  22. Configuring minidlna.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

Ubuntu下安装miniDLNAhttp://blog.csdn.net/wanruirui/article/details/14222283

1,安装

$ sudo apt-get install minidlna
   
   
  • 1
  • 1
  • 1

2,修改配置

$ sudo vi /etc/minidlna.conf
   
   
  • 1
  • 1
  • 1

3、你可以选择让minidlna随机启动

$ sudo update-rc.d minidlna defaults
   
   
  • 1
  • 1
  • 1

4、启动minidlna服务

$ sudo service minidlna start
   
   
  • 1
  • 1
  • 1

5、当你修改配置文件及媒体资源更新时,需要强制刷新,以便minidlna将最新的媒体文件进行索引

sudo service minidlna force-reload
   
   
  • 1
  • 1
  • 1

6、查看资源个数

http://192.168.1.106:8200/
   
   
  • 1
  • 1
  • 1

7、取消minidlna的开机自动启动

sudo update-rc.d -f minidlna remove
   
   
  • 1
  • 1
  • 1

8、停止minidlna服务

sudo service minidlna stop
   
   
  • 1
  • 1
  • 1

9、停止minidlna所有进程

sudo killall minidlna
   
   
  • 1
  • 1
  • 1

10、卸载minidlna

sudo apt-get remove --purge minidlna
   
   
  • 1
  • 1
  • 1
3.9 which/find

which用来查找可执行文件,find用来查找文件。另外,还有whereis,locate,不过在OpenWrt中默认没有这两个命令。

  1. root@mylinkit:/# which which
  2. /usr/bin/which
  • 1
  • 2
  • 1
  • 2
  • 1
  • 2
3.10 网络工具 //net-tools, iproute2, vlan, bridge-utils, wireless-tools
3.11 huawei 4g
  1. kmod-usb-serial
  2. kmod-usb-serial-option
  3. kmod-usb-serial-wwan
  4. usb-modeswitch
  5. kmod-mii
  6. kmod-usb-net
  7. kmod-usb-wdm
  8. kmod-usb-net-qmi-wwan
  9. usb-modeswitch-data
  10. uqmi
  11. kmod-usb-net-huawei-cdc-ncm
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
uart
开两个shell,一端:cat /dev/ttyS0,另一端: echo 1111 >/dev/ttyS0
   
   
  • 1
  • 1
  • 1

4. linux application

ubuntu环境下,需要安装下面的安装包用来编译openwrt。

sudo apt-get install git g++ make libncurses5-dev subversion libssl-dev gawk libxml-parser-perl unzip wget python xz-utils
   
   
  • 1
  • 1
  • 1
4.1 openssh-service

SSH服务是一个非常好的服务,采用加密方式进行文件传输。该服务可以替代telnet的明文连接,并且可以实现文件加密传输(scp)。

4.2 vnc server

在ubuntu12系统环境下

vnc server安装

$ sudo apt-get install vnc4server
   
   
  • 1
  • 1
  • 1

设置vnc Password

启动VNC Server

$ vncserver
   
   
  • 1
  • 1
  • 1

关闭一个VNC窗口

$ vncserver -kill :1
   
   
  • 1
  • 1
  • 1

安装gnome

apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
   
   
  • 1
  • 1
  • 1
4.3 git

https://git-scm.com/book/zh/v2/Git-%E5%9F%BA%E7%A1%80-%E6%92%A4%E6%B6%88%E6%93%8D%E4%BD%9C

  • git command**

  • git clone

  • git reset HEAD^
  • git reset HEAD^^
  • git reset HEAD~3/1
  • git reset -hard origin/master // 回退到远程最新版本
  • git remote add github https://github.com/xxxx/openwrt.git
  • git remote -v
  • git checkout -b huang
  • git branch
  • git pull github huang:master // 从远程github拉出huang分支到本地的master
  • git push github huang:master // 上传本地的huang分支到github远程的master
  • git merge

基础命令:撤销没有提交修改

$ git checkout -- config-3.18
   
   
  • 1
  • 1
  • 1

分支操作:合并master到分支

  1. git pull origon master // 从远程服务器更新master分支
  2. git checkout IR077H // 切换到IR077H分支
  3. git merge Master // 合并Master分支到当前分支
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

库:创建本地 git 库 example.git

  1. $ cd /opt/git
  2. $ mkdir example.git
  3. $ cd example.git
  4. $ git --bare init
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4

库:clone本地git库

$ git clone /opt/git/example.git
   
   
  • 1
  • 1
  • 1

库:clone ssh远程库

$ git clone git@192.168.1.1:/opt/git/example.git
   
   
  • 1
  • 1
  • 1

库;clone github库

# git clone https://github.com/MediaTek-Labs/linkit-smart-7688-feed.git
   
   
  • 1
  • 1
  • 1

4.3.7 从服务器更新本地文档

  1. $ git pull origin master:master
  2. $ git pull origin IR077H:IR077H
  • 1
  • 2
  • 1
  • 2
  • 1
  • 2

分支管理

创建分支并切换到分支
$ git checkout -b moh
   
   
  • 1
  • 1
  • 1
分支切换
$ git checkout moh
   
   
  • 1
  • 1
  • 1
分支合并 //合并master到moh分支
  1. $ git checkout moh
  2. $ git merge master
  • 1
  • 2
  • 1
  • 2
  • 1
  • 2

#

图形界面GitK
$ gitk
   
   
  • 1
  • 1
  • 1

gitk是linux下git自带的一个图形显示工具。可以使用这个工具在图形模式下察看详细的log文件等信息。

4.4 串口通讯

screen

ubuntu系统中使用如何使用RS232通讯,在系统中,可以采用screen命令。

  1. $ ls /dev/ttyUSB*
  2. $ sudo apt-get install screen
  3. $ sudo screen /dev/ttyUSB0 57600
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
4.5 tftp server

在openwrt系统更新环节中,有多种方法可以实现firmware更新。tftp方式就是一个方法。我们可以在ubuntu中创建一个tftp server,这样uboot就可以通过网线直接更新firmware了。这是一个非常简单的方式。

  • sudo apt-get install tftpd-hpa
  • config /etc/default/tftpd-hpa
  • start server /etc/init.d/tftpd-hpa start or start tftp-hpa
  • stop server /etc/init.d/tftpd-hpa stop or stop tftp-hpa

4.5.1 安装下面的安装包

$ sudo apt-get install xinetd tftpd tftp
   
   
  • 1
  • 1
  • 1

4.5.2 创建/etc/xinetd.d/tftp并且put this entry

  1. service tftp
  2. {
  3. protocol = udp
  4. port = 69
  5. socket_type = dgram
  6. wait = yes
  7. user = nobody
  8. server = /usr/sbin/in.tftpd
  9. server_args = /tftpboot
  10. disable = no
  11. }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
4.6 scp(secure copy)安全文件传输

Secure copy or SCP is a means of securely transferring computer files between a local host and a remote host or between two remote hosts. It is based on the Secure Shell (SSH) protocol.[1]

 scp ~/.ssh/id_dsa.pub root@192.168.1.1:/tmp
   
   
  • 1
  • 1
  • 1
4.7 重定向 0,1,2 >&1,>&2

0 是 < 的默认值,因此 < 与 0<是一样的;同理,> 与 1> 是一样的

  1. 标准输入(stdin):代码为0,使用<或<<;
  2. 标准输入(stdout):代码为1,使用>或>>;
  3. 标准错误输出(stderr):代码为2,使用2>或2>>。 
    0:Standard Input(STDIN) 
    1:Standard Output(STDOUT) 
    2:Standard Error Output(STDERR) 
    http://blog.csdn.net/thirstyblue/article/details/7974300 
    http://www.cnblogs.com/Centaurus/archive/2013/05/25/3098256.html
  1. $ls /dev 1>filename //把命令的标准输出重新定向到一个文件filename
  2. $ls /dev >>filename //把输出追加到filename文件的末尾
  3. $ls -qw /dev 2>filename //把标准错误重新定向到文件
  4. $ls /dev &>filename //把标准输出和错误都定向到文件
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
4.8垃圾黑洞 /dev/null
$find /home -name .basehrc 2> /dev/null
   
   
  • 1
  • 1
  • 1
4.8 yes 命令
4.9 du 查询磁盘空间使用情况
# du /
   
   
  • 1
  • 1
  • 1
4.10 PID查询命令ps, pidof, pgrep
4.11 串口通讯 uart

得到串口数据

# cat /dev/ttyUSB0
   
   
  • 1
  • 1
  • 1
$screen /dev/cu.usbserial-XXXXXXXX 57600
   
   
  • 1
  • 1
  • 1
4.12 screen 串口命令
ubuntu@ubuntu-System-Name:~$ sudo screen /dev/ttyUSB1 57600
   
   
  • 1
  • 1
  • 1
  1. ubuntu@ubuntu-System-Name:~$ screen
  2. -D -RR Do whatever is needed to get a screen session.
  3. -e xy Change command characters.
  4. -f Flow control on, -fn = off, -fa = auto.
  5. -h lines Set the size of the scrollback history buffer.
  6. -i Interrupt output sooner when flow control is on.
  7. -l Login mode on (update /var/run/utmp), -ln = off.
  8. -list or -ls. Do nothing, just list our SockDir.
  9. -L Turn on output logging.
  10. -m ignore $STY variable, do create a new screen session.
  11. -O Choose optimal output rather than exact vt100 emulation.
  12. -p window Preselect the named window if it exists.
  13. -q Quiet startup. Exits with non-zero return code if unsuccessful.
  14. -r Reattach to a detached screen process.
  15. -R Reattach if possible, otherwise start a new session.
  16. -s shell Shell to execute rather than $SHELL.
  17. -S sockname Name this session <pid>.sockname instead of <pid>.<tty>.<host>.
  18. -t title Set title. (window's name).
  19. -T term Use term as $TERM for windows, rather than "screen".
  20. -U Tell screen to use UTF-8 encoding.
  21. -v Print "Screen version 4.00.03jw4 (FAU) 2-May-06".
  22. -wipe Do nothing, just clean up SockDir.
  23. -x Attach to a not detached screen. (Multi display mode).
  24. -X Execute <cmd> as a screen command in the specified session.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
4.13 后台运行命令

在linux中,让程序在后台运行的话,其实很简单。只要在运行程序的时候,在后面增加&符号就可以了。

5. Uboot

5.1 编译Uboot
  1. $git clone https://github.com/MediaTek-Labs/linkit-smart-7688-uboot.git
  2. $cd linkit-smart-7688-uboot
  3. $sudo tar jxf buildroot-gcc342.tar.bz2 -C /opt/
  4. $make
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
  • 1
  • 2
  • 3
  • 4
5.2 修改uboot串口号

修改文件linkit-smart-7688-uboot\board\rt2880\serial.h

line21: #define CFG_RT2880_CONSOLE RT2880_UART3

5.3 uboot环境变量打印/修改(printenv,setenv,saveenv)
  1. MT7628 # printenv
  2. bootcmd=tftp
  3. bootdelay=1
  4. baudrate=57600
  5. ethaddr="00:AA:BB:CC:DD:10" //
  6. ipaddr=10.10.10.123 // 设备IP
  7. serverip=10.10.10.3 // 服务器IP
  8. stdin=serial
  9. stdout=serial
  10. stderr=serial
  11. Environment size: 149/4092 bytes
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  1. MT7628 # setenv ipaddr 192.168.1.120
  2. MT7628 # setenv serverip 192.168.1.116
  3. MT7628 # saveenv
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
5.4 linkit u-boot特有烧录功能

5.4.1 uboot更新uboot-env环境变量

a. 在U盘中创建lks7688.cfg文件

  1. $cat lks7688.cfg
  2. wifi_ssid=moh_app
  3. wifi_key=12345678
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

b. 插入u盘到开发板usb端口,按下wifi按钮,复位板子。等待wifi指示灯亮后,松开wifi按钮。uboot烧录配置到uboot-env

5.4.2 uboot更新固件

a.烧录lks7688.img到U盘

b.插入u盘,按下wifi按钮,复位板子,等待大约5秒(wifi指示灯亮然后灭掉),松开wifi按钮,uboot开始烧录firmware

5.4.3 uboot更新uboot

a. 复制lks7688.ldr到U盘

b. u盘,按下wifi按钮,复位板子,等待大约20秒,松开wifi按钮,uboot更新uboot。

5.5 Uboot源代码分析

5.5.1 lib_mips/board.c

linkit-smart-7688-uboot的主要代码内容在这个文件当中,如果想对该uboot进行一些功能修改的话,可以在这个文件中进行进行。

6 shell command

6.1 pidof madplay
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/65298
推荐阅读
相关标签
  

闽ICP备14008679号