|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
本文以飞凌嵌入式RK3399开发板为基础讲解,主要介绍了Ubuntu系统下双屏显示及异触,其它RK3399平台请参考使用!+ R% \* s) o0 M& I+ p
xrandr命令, Q# K) R9 z: B# E
“xrandr”是一款官方的 RandR扩展配置工具,它可以设置屏幕显示的大小、方向、镜像等。对于多屏幕显示的情况,可以使用xrandr进行管理。
9 I" D( n% p O- n: I0 P- @/ q: g6 G" y _7 ]% G/ e. L
. R6 \/ X, q& @forlinx@forlinx:~$ xrandr --help
& y3 r4 c( [# E. ]% C, K" p8 Iusage: xrandr [options]9 {: I/ v" s, x7 k
where options are:# I( Q7 p7 o- f% K
--display <display> or -d <display># I9 U- T+ ?1 q6 S, Y# w
--help
. E) T3 M: ^1 r0 c! @: d -o <normal,inverted,left,right,0,1,2,3>
f& m/ h+ M5 \ @: u& K1 W X3 s or --orientation <normal,inverted,left,right,0,1,2,3>
0 G/ W2 U& c5 v5 A9 `* Q -q or --query
2 B1 l! @/ }( v& e5 v -s <size>/<width>x<height> or --size <size>/<width>x<height>
6 s [* ~& O# G/ w& u/ C' \ -r <rate> or --rate <rate> or --refresh <rate>
& ^2 i6 F" b' v; v m7 p1 q* O -v or --version6 z1 N3 A) ^% \! E8 n6 g' l1 J
-x (reflect in x)
' N( p2 _3 t | -y (reflect in y)3 Q* j. e+ A* K E: ?: e8 i' k
--screen <screen>
) ]2 C* u+ j& ]: F, d' z --verbose
0 ^* Z) C7 [5 g$ w+ A0 C5 i --current
) `4 P( F6 v- B; v& a --dryrun$ b3 a+ {. \5 J$ v8 R
--nograb
i5 O5 `7 ]6 C; ]1 X+ | --prop or --properties
1 X3 r/ Z8 S: V* R --fb <width>x<height>' } L6 E7 }5 M4 d, {9 w
--fbmm <width>x<height>7 }2 {5 g5 V( E# L( v
--dpi <dpi>/<output>
6 q! Z, N# h; ^2 X2 W --output <output>
, g$ e6 P' Y) c; [& Q --auto+ R6 R: q( W2 `4 `( d6 q1 s' d' E
--mode <mode>
O6 e* k, L- Y# X% J --preferred: q0 B) n1 l! _+ v$ i8 _3 a- p6 ~
--pos <x>x<y>% c: h( c8 a; |+ W2 \) { L6 |
--rate <rate> or --refresh <rate>
. t" n. u/ E% |9 c+ Y% b --reflect normal,x,y,xy
: J% G9 c5 w5 o$ P* d0 \5 d --rotate normal,inverted,left,right0 v# x- Q$ c3 w* `/ Y
--left-of <output>
/ E; E) i' G0 I, T9 r. _) T( f --right-of <output>1 e: x, b, A, |5 b8 b; w# e
--above <output>3 [ F& {3 w1 W
--below <output>* k: e* y( D2 ?
--same-as <output>5 p3 y; V* l5 A7 t
--set <property> <value>
& F, z+ U" n6 @. g8 ^5 C --scale <x>x<y>
& H, \2 c0 R* K --scale-from <w>x<h>
L$ i5 i5 W- E% l* T% n9 [6 ?2 f5 { --transform <a>,<b>,<c>,<d>,<e>,<f>,<g>,<h>,<i>$ Y0 q: H! k: |2 w$ @$ }( F
--off! A/ ? |: T6 f3 P |
--crtc <crtc># U9 C7 c/ ?2 b! }( z
--panning <w>x<h>[+<x>+<y>[/<track:w>x<h>+<x>+<y>[/<border:l>/<t>/<r>/<b>]]]
) p3 w# t$ K* u( @& A9 O --gamma <r>:<g>:<b>- k) s" O1 ]6 {) u$ v7 X" O! q
--brightness <value>
$ H: W" {' m& q% y5 q; l --primary! l- d" ?# t7 ?) ?- g
--noprimary8 E3 G7 Y6 F y5 M; D
--newmode <name> <clock MHz>
7 r3 H6 j7 B; Q# o3 N% u% A7 m <hdisp> <hsync-start> <hsync-end> <htotal>
! ?/ e3 Z4 e P5 `( o8 u. Q6 j <vdisp> <vsync-start> <vsync-end> <vtotal>4 ]8 p( Q$ B& R5 C
[flags...]) y1 u) e# J% Y& y; ?4 I% P: z7 q( e/ I
Valid flags: +HSync -HSync +VSync -VSync
: ]% R; f8 ^& ]5 Z. [- R +CSync -CSync CSync Interlace DoubleScan
: @! H- S- z8 r) Q2 R --rmmode <name>
% v, h+ Q8 {9 X/ ?" o/ r x --addmode <output> <name>
: b3 x" C. D; ~. w& Q# Q --delmode <output> <name>4 O& w c7 @( M5 F4 \9 W8 E
--listproviders2 g+ R: ] R- q) F( z
--setprovideroutputsource <prov-xid> <source-xid>
" a% S9 G; |' f, I6 z. n --setprovideroffloadsink <prov-xid> <sink-xid>
* ?( Y! C* x9 j' ~* Z* r --listmonitors% o( a) k$ \" ^
--listactivemonitors
0 X O: ~2 u7 w3 d7 A --setmonitor <name> {auto|<w>/<mmw>x<h>/<mmh>+<x>+<y>} {none|<output>,<output>,...}8 k. ` ^" c! m, n
--delmonitor <name>
7 T" C) l7 z; J/ L) L* m双屏扩展显示
. O" v% G! |" |. H0 v5 m
, v( n: w$ k/ E L$ q; I. @OK3399-C Ubuntu系统支持xrandr命令管理多屏扩展显示。同时接入eDP屏幕和HDMI屏幕,系统会默认非热插拔显示设备作为主屏,所以eDP会被识别为primary screen。默认会设置两个屏幕为扩展显示。( Y4 y! J& d. s Z3 U
6 G7 d# n2 ~6 |$ ]) Q8 aforlinx@forlinx:~$ xrandr* |* Y [. t- p3 p# d# g1 N1 ?' M
Screen 0: minimum 320 x 200, current 2560 x 1440, maximum 8192 x 8192
+ F0 P: _2 x. h" u9 N; ceDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 276mm x 156mm( F J9 g# D7 o$ l
1920x1080 60.00*+! L$ G$ _+ ^; w" {; ]
HDMI-1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm4 F9 S; n( l7 a( O+ E* G h
2560x1440 59.95* ' B) m& f" }+ P" _
1920x1080 60.00 50.00 59.94
) W: ^9 B6 {0 N. s* L( }- h 1680x1050 59.88 6 j4 W: y% N) K% l1 n# P
1280x1024 75.02 60.02
N) W$ o: E4 d, G% |8 S 1440x900 59.90
" }5 h; |" F- Z8 y7 q+ U$ y 1280x960 60.00 + |/ a0 e2 [( P o
1280x720 60.00 50.00 59.94
6 {, Y/ C6 j9 v3 z" i( T1 [/ ?3 B 1024x768 75.03 70.07 60.00 9 ~4 e+ d$ _4 y& _2 P+ z
832x624 74.55 : O( e. r0 `8 w! v6 ]# ]7 f
800x600 72.19 75.00 60.32 56.25 : V- i4 v9 v9 s
720x576 50.00
& [3 l- S# k0 }5 f9 k: C 720x480 60.00 59.94 ! c T# T( X- Y/ ^; L7 L
640x480 75.00 72.81 66.67 60.00 59.94
0 _% I# y4 b2 X, g% ?; Z 720x400 70.08
8 }" f F; w! y! H可以使用xrandr在两个屏幕中选择哪个做主屏,哪个做副屏。6 ~2 z0 X; p" p% _# R0 x
/ [& s2 d1 V: `$ J: ?0 ]; D2 Y2 i$ ?
xrandr --output eDP-1 --right-of HDMI-1 --auto
1 D1 Z/ T3 [+ e, ?+ D1 h n/ u- k+ j f3 ~: a9 t
也可以将两个屏幕设置成同显1 J& N. }9 G4 ~2 }
2 a6 I; I7 L3 P( ^xrandr --output HDMI-1 --same-as eDP-1 --auto
8 w" | J. @) ~
) d4 T" ]6 { x, {1 [9 |2 P% Hxinput命令
W# J5 b/ R; G. F# l+ K, F. h6 l5 [: c$ p o
xinput命令用于管理系统的输入设备。
. [$ E g! V. v' l' C+ M: I; R* N) y) t& c7 |8 j" g
forlinx@forlinx:~$ xinput --help
0 z `5 o7 O# d& d' @7 e4 A) h ousage :
. C! c" ~" z$ r xinput get-feedbacks <device name>: `2 ]: T+ o0 L1 Q5 Y
xinput set-ptr-feedback <device name> <threshold> <num> <denom>, w1 Q1 z$ Y& Z' E# B5 L
xinput set-integer-feedback <device name> <feedback id> <value>
; Y: }5 q. A4 Z8 q0 h7 y) j6 b& }: X xinput get-button-map <device name>/ e O& @( o/ N( O5 G: M; j8 n: Z* O
xinput set-button-map <device name> <map button 1> [<map button 2> [...]]$ S4 f9 \) b+ N
xinput set-pointer <device name> [<x index> <y index>]
" G. q; D) j' x/ |" D# i! P xinput set-mode <device name> ABSOLUTE|RELATIVE3 i5 I1 h/ }& Z; m2 j
xinput list [--short || --long || --name-only || --id-only] [<device name>...]
! M X- \+ W' u; f; | xinput query-state <device name>
$ W5 \# B- f/ a( W! @ xinput test [-proximity] <device name>
4 `! D* ~9 f5 g& @+ D5 s7 | a# X S xinput create-master <id> [<sendCore (dflt:1)>] [<enable (dflt:1)>]7 \) T! f X7 I( V: l
xinput reMOVe-master <id> [Floating|AttachToMaster (dflt:Floating)] [<returnPointer>] [<returnKeyboard>]
, h b# H9 g( l+ e: P8 f1 R xinput reattach <id> <master>
2 _5 P8 l6 o' L. G xinput float <id>
9 Y8 a% W5 E7 n' Y xinput set-cp <window> <device>
/ Q( W( w8 N4 {) u7 D# X xinput test-xi2 [--root] <device>
) w8 O8 ^" W& I, f# ~ xinput map-to-output <device> <output name>
* P0 j4 `% [, b- t, g* S xinput list-props <device> [<device> ...]0 v- @. W9 D/ p. J+ e
xinput set-int-prop <device> <property> <format (8, 16, 32)> <val> [<val> ...]' X1 u& a8 W: `1 H, |7 D
xinput set-float-prop <device> <property> <val> [<val> ...]
9 m1 o6 G0 j( u9 s% i xinput set-atom-prop <device> <property> <val> [<val> ...]' Y; E, ?+ Y7 v% }8 p- n6 X; Z8 g
xinput watch-props <device>- V4 e. D1 \% V5 H5 J% \
xinput delete-prop <device> <property>. I0 t* X1 x6 l) k9 j; [6 [
xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]( o8 j" b/ V# Y: `
xinput disable <device>
/ ^+ d m; K! L1 h. O xinput enable <device>
+ Q9 B7 G+ [( g8 g& L. N分别插入了“wch.cn USB2IIC CTPCONTROL”和“ILITEK ILITEK-TP”两个USB电容触摸屏。
" q+ {( D" b/ b0 B; a7 _3 O `3 x. M/ s
forlinx@forlinx:~$ xinput- u' B+ N1 q+ t
⎡ Virtual core pointer id=2 [master pointer (3)]
6 V j; Z& ?+ g8 f% w7 m* O⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
- J+ [( e }% ^8 O. N6 f9 G: R8 _⎜ ↳ wch.cn USB2IIC_CTP_CONTROL id=9 [slave pointer (2)]& w. V4 e# I3 b. ^) o
⎜ ↳ ILITEK ILITEK-TP id=6 [slave pointer (2)]
5 ?. K5 L2 V7 I. g I⎣ Virtual core keyboard id=3 [master keyboard (2)]# ~/ y l4 s$ F; n
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
: j% a# p+ V& N. W* U& b1 b ↳ rk_headset id=7 [slave keyboard (3)]
/ W/ r: ~ }( J- y! h ↳ rk29-keypad id=8 [slave keyboard (3)]
- ^. x3 C; m* d& o ↳ InputEmulator id=10 [slave keyboard (3)]) h# E3 b( L. U. i5 d8 G
双屏异触# D+ b2 o2 y8 ?1 n1 x1 w: H
/ p& q0 k2 r4 u- c
使用xinput对触摸设备和显示设备进行绑定。ILITEK ILITEK-TP触摸设备的id是6,将其与eDP-1绑定。wch.cn USB2IIC CTPCONTROL触摸设备的id是9,将其与HDMI-1绑定。
4 L; r, G# }5 Y# i; N/ [! I5 ~* `+ C/ u) d1 ]( `+ N" Z
forlinx@forlinx:~$ xinput map-to-output 6 eDP-1# t! Z" t( o6 T
forlinx@forlinx:~$ xinput map-to-output 9 HDMI-1+ @3 ^1 A! v' K: D: c8 x
这样就可以实现RK3399下双屏异触了。测试了一下,两个屏幕各自的触摸效果还不错。
; u% V- {' j( }% v3 K5 h H8 x) F+ ?! x/ j2 L) p; ]
▼效果如下:0 B2 f4 d% {0 {$ {- E. Y0 K; w
) p: f$ R2 ?' l" M0 Y
0
3 S) v" S, n+ W2 C6 @, }
& n0 n3 T& q( h/ b- Q! K, t! S) c9 N& u, x. X3 w& A
' K5 y: o5 c& _/ O7 C% ?9 _; R |
|