📄 usbserial
字号:
#!/usr/bin/tclsh## Author: (c) Bernd Blessmann 2001-03-08## related: winbond W9967/8 CF, Creative Webcam go## getSerial.tcl reads sniffed and preprocessed (see pre.pl from the# sniff2mod package) data and extracts the values programmed to the# registers CR06-CR09 and puts them out as c-code.#if {$argc != 0} { if [catch {open [lindex $argv 0] {RDONLY}} fileId] { puts stderr "Cannot open [lindex $argv 0]: $fileId" exit 1 }} else { set fileId "stdin"}while {[gets $fileId line] >= 0} { # search start of URB if [regexp {^URB ([0-9]+) going down} $line match urb] { # next line is URB_FUNCTION if {[gets $fileId line] >= 0} { if [regexp {^URB_FUNCTION_VENDOR_DEVICE:} $line match] { # collect next lines catch {unset urbLines} lappend urbLines $line set notReady 1 while {$notReady} { if {[gets $fileId line] >= 0} { lappend urbLines $line if [regexp {^Index +([0-9a-f]+)} $line match index] { set notReady 0 if {$index == 0006} { regexp {.+([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])} [lindex $urbLines 10] match b0 b1 puts -nonewline "/* urb [format %4d $urb] */ " puts -nonewline "buf\[DATA_COUNT\] = \{ " puts -nonewline "0x$b1, 0x$b0" for {set i 0} {$i < 6} {incr i} { puts -nonewline ", 0x[lindex [lindex $urbLines 6] $i]" } puts " \};" } } } else { set notReady 0 } } } } }}if {$fileId != "stdin"} { close $fileId}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -