用镜头记录,用心灵体验 | 订阅本站 | 所有笔记 | 亲和力设计 | 流量

DB2 学习笔记

博客话题:DB2,Linux,Web,业余无线电,户外,摄影,截拳道,Thankpad,其他

Linux

Gentoo Linux on T43 (17) VGA输出

目录

  1. 接口
  2. xrandr
  3. Fn+keys
  4. 下载
  5. 参考资料

接口

VGA 的输出可以利用xrandr 命令控制,这个软件包应该已经跟随xorg-x11安装好了。

通过xrandr 命令的输出,知道T43支持以下视频接口:

  • VGA
  • DVI
  • LVDS
  • S-video

VGA接口在笔记本右侧,可外接显示器、投影仪等VGA 设备。

DVI接口在产品的spec中并没有声称支持,机身也找不到借口,但可以被检测到,猜测笔记本内可能存在相关的硬件。

LVDS就是内置的液晶屏接口。

S-video在USB接口旁边,我从未测试过。

xrandr

不带参数的xrandr 命令会列出系统支持的视频接口名称和设备连接情况。

$ xrandr
Screen 0: minimum 320 x 200, current 1400 x 1050, maximum 1400 x 1200
VGA-0 disconnected (normal left inverted right x axis y axis)
DVI-0 disconnected (normal left inverted right x axis y axis)
LVDS connected 1400x1050+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1400x1050      50.0*+
1280x1024      59.9  
1024x768       60.0     59.9  
800x600        60.3     59.9  
640x480        59.9  
S-video disconnected (normal left inverted right x axis y axis)

用以下命令将视频输出发送到某个接口设备。

 $ xrandr --output VGA-0 --auto

用以下命令关闭某个接口设备的视频输出。

 $ xrandr --output VGA-0 --off

Fn+keys

下面的脚本用于Fn+F7 控制VGA 输出的转换,脚本会自动搜索connected 到VGA输出的设备(包含内置液晶屏LVDS;S-video可能会支持,但未做测试),并顺序将显示输出到每一个设备,同时关闭所有其它设备的输出,这其中还包含一个将所有设备打开的步骤,整个过程循环。

00001007)
# Fn + F7 (Switch VGA/DVI/LVDS/S-video)
default=LVDS
# 1: connected and online
# 0: connected but not online
# N: disconnected
# i.e. "VGA-0 0 DVI-0 N LVDS 1 S-video N"
#screen=$(/usr/bin/xrandr |awk '/connected| \+|\*\+/ { \
#            if (match($2, /^connected$/) > 0) {printf $1 FS; next} \
#            else if (match($2, /^disconnected$/) > 0) {print $1, "N"; next} \
#            else if (match($0,/\ \+/) > 0) {print "0"} \
#            else if (match($0,/\*\+/) > 0) {print "1"} }')
screen=$(/usr/bin/xrandr |awk '/connected| \+|\*\+/ { if (match($2, /^connected$/) > 0) {printf $1 FS; next} else if (match($2, /^disconnected$/) > 0) {print $1, "N"; next} else if (match($0,/\ \+/) > 0) {print "0"} else if (match($0,/\*\+/) > 0) {print "1"} }')
#screen="VGA-0 0 DVI-0 N LVDS 1 S-video N"
arr_output=($(echo $screen |xargs -n2 |awk '{print $2 == "N"?"":$1}')) # connected screens
arr_status=($(echo $screen |xargs -n2 |awk '{print $2 == "N"?"":$2}')) # 1: online; 0: offline
logger -t "$0" "Supported Output: $(echo $screen |xargs -n2 |cut -d' ' -f1 |xargs)"
logger -t "$0" "Connected Output: $(echo $screen |xargs -n2 |awk '{ if ($2 == 1) print $1"*"; else if ($2 == 0) print $1 }' |xargs)"
[[ $(echo ${arr_status[@]} |xargs -n1 |awk /1/ |wc -l) -eq ${#arr_status[@]} ]] && all_online=1
[[ $(echo ${arr_status[@]} |xargs -n1 |awk /0/ |wc -l) -eq ${#arr_status[@]} ]] && all_offline=1
if [[ $all_offline -eq 1 ]] ; then
xrandr --output $default --auto
return
fi
[[ ${#arr_output[@]} -ne ${#arr_status[@]} ]] && return 1
[[ ${#arr_output[@]} -le 1 ]] && return
i=0
while [[ $i -le ${#arr_output[@]} ]]
do
next=$((i + 1))
[[ $next -ge ${#arr_output[@]} ]] && next=0
if [[ ${arr_status[$i]} -eq 1 ]] ; then
if [[ ${arr_status[$i]} -eq 0 && $all_online -ne 1 ]] ; then
logger -t "$0" "Switching all outputs on: ${arr_output[@]}"
for output in ${arr_output[@]}
do
xrandr --output $output --auto
done
break
fi
logger -t "$0" "Switching ${arr_output[$next]} off"
xrandr --output ${arr_output[$next]} --auto
logger -t "$0" "Switching ${arr_output[$i]} on"
xrandr --output ${arr_output[$i]} --off
break
fi
i=$((i + 1))
done
;;
 

上面这段脚本用于acpi的事件处理,这部分内容请查看Fn + Keys

下载

以上脚本包含在/etc/acpi/default.sh ,请根据自己的情况提取使用。

参考资料

 

Alex's picture

my email address in picture

搜索|Search

评论|Recent Comments

按月归档|By Month

2009
07
2008
11
10
07
05
04
03
02
01
2007
12
10
07
06
05
04
03
02
01
2006
12
11
10
09
08
07
06
05
04
03
02
01
2005
11
10
09
08
07
04
03
2004
12
11
10
09
08
07
06
05
04
03
02
01
2003
12
10
09
08
06
2002
09
08
04
03
02
2001
12
09
07
06
05

我读|My Books

我的链接|My Links

我的朋友|My Friends

Creative Commons License
This blog is licensed under a Creative Commons License.
Movable Type 4 Logo