|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
本文以飞凌嵌入式RK3399开发板为基础讲解,主要介绍了Ubuntu系统下双屏显示及异触,其它RK3399平台请参考使用!
i+ B! D2 J4 @* f( Z' }: F3 Ixrandr命令
, N+ i) p: ~1 E: m: y5 ~) v“xrandr”是一款官方的 RandR扩展配置工具,它可以设置屏幕显示的大小、方向、镜像等。对于多屏幕显示的情况,可以使用xrandr进行管理。% |" p( x* {* B2 m- y1 D
$ X3 v& o+ s Z& I
0 W& E) k' o6 @* g
forlinx@forlinx:~$ xrandr --help, X& R3 x, G* K t
usage: xrandr [options]5 r! e [1 A0 K7 K# Y
where options are:
- ~6 z5 I$ ?; C/ j --display <display> or -d <display>
: F' A ]( B" J --help
7 z4 D4 a% X. x -o <normal,inverted,left,right,0,1,2,3>+ k& W8 e" J8 X# a
or --orientation <normal,inverted,left,right,0,1,2,3>* }- x8 x" U" f* V% J
-q or --query& m% \9 q1 m# r4 C, t- U8 b
-s <size>/<width>x<height> or --size <size>/<width>x<height>
; q* M. ]2 d9 }2 N -r <rate> or --rate <rate> or --refresh <rate>) E* @' B' G8 Y
-v or --version* j% \' b2 x; `5 S& S' Z7 V
-x (reflect in x)
% d( X! ]6 { p( A3 Z! I" ~0 o$ G -y (reflect in y)
3 b+ u% g( s: k) s( m1 _! u --screen <screen>: |! L" r% `3 q. Z) \9 z' v
--verbose
# @3 a. J) N7 j3 Q' b6 e* ~: j --current( x* ? d' B5 T
--dryrun; W, P2 |1 u/ p2 t+ C
--nograb- W2 K( A9 f3 V( M' m
--prop or --properties$ X7 S9 j0 A8 R/ z4 T
--fb <width>x<height>$ R7 n+ e$ ]# B2 X$ a8 `! ?' h; c
--fbmm <width>x<height>
( C: Y- h9 P) Y c! r --dpi <dpi>/<output>
. x1 M* R- s) m --output <output>* `/ a, C/ x+ b: L. @
--auto' Z* z! @+ ?: A8 J# i4 U5 y5 W6 b2 c
--mode <mode>+ m2 w; _' Y H& Y1 _
--preferred
4 F4 j' V, w( e, @, s, ^/ C --pos <x>x<y>' `' B- q' c3 f
--rate <rate> or --refresh <rate>
. G9 ?, H6 G; H/ Y1 Z7 x --reflect normal,x,y,xy
' z7 n; P1 w, A0 @% ] --rotate normal,inverted,left,right4 g& g, [3 Q- N. L
--left-of <output>
' }2 Q* _: q+ {! k# e# ? --right-of <output>; H! \6 y q, `, O, K
--above <output>
* Y8 U( _* ]! k H --below <output>
( O5 I" [0 I* ^7 r! D! Z --same-as <output>2 l* r( T. n1 v7 @
--set <property> <value>. p$ n. G4 f( o7 s
--scale <x>x<y>
+ O1 U1 e7 ]7 O7 r --scale-from <w>x<h>7 y! Z+ a* m9 W/ M1 R
--transform <a>,<b>,<c>,<d>,<e>,<f>,<g>,<h>,<i>- R6 I l' X4 V1 z- _- \6 c2 ]
--off+ z- O% }1 T* I% k
--crtc <crtc>
, a" ]- e1 A/ p a% E+ t --panning <w>x<h>[+<x>+<y>[/<track:w>x<h>+<x>+<y>[/<border:l>/<t>/<r>/<b>]]]/ F6 g9 w6 O4 [
--gamma <r>:<g>:<b>
5 W$ P- Z+ Q4 `1 }7 H --brightness <value>
" M# x6 O$ c6 ^, y" M8 A$ x --primary9 K. o1 K$ ~; f7 x
--noprimary' C4 Z2 R: {- ^! f
--newmode <name> <clock MHz>
* o. d, t* e0 p <hdisp> <hsync-start> <hsync-end> <htotal>" S7 F8 Q# r* i- R. H3 ~- ?' H0 [" {
<vdisp> <vsync-start> <vsync-end> <vtotal>
% J [3 M) [9 H5 x: W# g [flags...]$ d3 Z2 Q# l4 z
Valid flags: +HSync -HSync +VSync -VSync
% L- C; k. R9 F +CSync -CSync CSync Interlace DoubleScan
) \( F/ d7 ^, y8 K( B) T* Q' ] --rmmode <name>
( R3 I$ x" D1 F$ _/ \7 ] --addmode <output> <name>
3 }7 F c, B. T1 H3 B --delmode <output> <name>. _$ ?) t; a: N! T2 T% s) P$ j# J# x
--listproviders5 [2 c/ n! \3 X
--setprovideroutputsource <prov-xid> <source-xid>
# ]& J( K1 d9 y --setprovideroffloadsink <prov-xid> <sink-xid>- B- d; ~) W; r+ {1 m
--listmonitors
) T; k7 u* `9 l2 Y --listactivemonitors
( f" r7 n6 I" m6 U --setmonitor <name> {auto|<w>/<mmw>x<h>/<mmh>+<x>+<y>} {none|<output>,<output>,...}
2 J( s: P: G$ `0 H6 p& L --delmonitor <name>+ H3 l, B# Q% j/ e" |
双屏扩展显示) {# w$ ^ [0 @
2 V1 ^& L$ @' L7 R: O1 Y0 R- HOK3399-C Ubuntu系统支持xrandr命令管理多屏扩展显示。同时接入eDP屏幕和HDMI屏幕,系统会默认非热插拔显示设备作为主屏,所以eDP会被识别为primary screen。默认会设置两个屏幕为扩展显示。3 S* a" |- L; s2 B
! k k3 N' ~' x& u( d0 x( e E' z- ~forlinx@forlinx:~$ xrandr2 D7 a! @1 I$ i; p4 {1 Z; N! p$ h: _
Screen 0: minimum 320 x 200, current 2560 x 1440, maximum 8192 x 81929 N2 |9 y5 s4 I" p9 r7 z
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 276mm x 156mm7 a3 P4 u! V( F2 f% }1 k
1920x1080 60.00*+5 R: L. S6 ^% `# E/ N/ I, p" l
HDMI-1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm7 [, w6 { `" d1 ^8 R0 b' M9 I
2560x1440 59.95* $ M/ X" W5 g# X, m% A
1920x1080 60.00 50.00 59.94 7 y; p- E9 G9 s8 _- D' }
1680x1050 59.88 4 Q3 y" L) `! Z {3 v# y8 L! V
1280x1024 75.02 60.02
8 N {3 t: B) q. e0 Z; b* d 1440x900 59.90 M7 R6 G0 f5 G( _1 E, F, z# V+ {
1280x960 60.00
; K5 o/ t& w2 O7 l: ]# k1 Z 1280x720 60.00 50.00 59.94 5 ]8 _* ], [5 T9 m3 y! A
1024x768 75.03 70.07 60.00
6 Q6 H% x3 t" V 832x624 74.55 3 e( c* V! t' g2 x4 h
800x600 72.19 75.00 60.32 56.25
' Q& F+ U% ?5 p3 F 720x576 50.00
1 p# B3 Q* z' i. Q- { 720x480 60.00 59.94
+ |: `; S8 C. P, j {7 T3 S 640x480 75.00 72.81 66.67 60.00 59.94
3 Q9 z" q3 f4 H5 o. p" e+ G 720x400 70.08, E' Z. ~3 _: }' i9 u: d
可以使用xrandr在两个屏幕中选择哪个做主屏,哪个做副屏。
% W' p9 V7 r- t# M" R. c- c5 ?5 t( ~. A5 t, e& ~
xrandr --output eDP-1 --right-of HDMI-1 --auto+ l1 C3 Y3 i. b/ J* R
2 p8 v$ _/ ~) r) M& S& ]& t也可以将两个屏幕设置成同显2 ?7 e' `* {9 C9 ]
0 U' W, X: P. f: w% \xrandr --output HDMI-1 --same-as eDP-1 --auto7 d2 Q1 `. V: @0 g0 D( E
4 D" g- U. {1 X% Nxinput命令
* O% X: w6 b- r0 K) c8 b; W% F( Q+ G; E: k
xinput命令用于管理系统的输入设备。) O2 d2 ^0 p8 a
. e% o; V( V3 R% U9 |8 J! Tforlinx@forlinx:~$ xinput --help
# X& f& z S4 T7 }usage :$ c4 _, V' E& |
xinput get-feedbacks <device name>9 H: M& Z5 a0 c
xinput set-ptr-feedback <device name> <threshold> <num> <denom>
' e& C# m) k! H$ @" o xinput set-integer-feedback <device name> <feedback id> <value>' V. G5 ^7 W( y8 w6 Y
xinput get-button-map <device name>' [9 A3 {" P. Y$ w' P
xinput set-button-map <device name> <map button 1> [<map button 2> [...]]9 N2 C9 R- O8 y7 G/ L& O8 J% d
xinput set-pointer <device name> [<x index> <y index>]" ?' @: ^; L/ k! m' G
xinput set-mode <device name> ABSOLUTE|RELATIVE
8 v* B+ w9 G3 F3 x }, H xinput list [--short || --long || --name-only || --id-only] [<device name>...]
, F( |7 z7 A* W7 I# I& o xinput query-state <device name>
+ K$ y |. ? n5 ~ xinput test [-proximity] <device name>
( n8 m# V% [% F2 R9 t xinput create-master <id> [<sendCore (dflt:1)>] [<enable (dflt:1)>]
5 E/ U% P9 Z [7 k1 W xinput reMOVe-master <id> [Floating|AttachToMaster (dflt:Floating)] [<returnPointer>] [<returnKeyboard>]
3 C9 W6 J \! v5 ?3 W5 G/ `5 Q, ? xinput reattach <id> <master>, _4 H1 i$ X1 |& [1 k( @
xinput float <id>1 r5 b- c3 t+ J4 C- T
xinput set-cp <window> <device>' [( e; u' R# e# o% e6 Y
xinput test-xi2 [--root] <device>
; j, X$ B/ U; K/ h& H xinput map-to-output <device> <output name>
* Y3 T" C- @& i9 X: k4 j* H1 S xinput list-props <device> [<device> ...]8 Z( T4 p6 r& m8 h
xinput set-int-prop <device> <property> <format (8, 16, 32)> <val> [<val> ...]9 n; ]; a9 i( A
xinput set-float-prop <device> <property> <val> [<val> ...]; a2 W- ^7 R1 N) L1 i! v
xinput set-atom-prop <device> <property> <val> [<val> ...]. S- O) }. ]1 ^. w5 x
xinput watch-props <device>7 ~0 V& N6 g' d6 [
xinput delete-prop <device> <property>" h. C- g: t: F8 o1 a: R
xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
: h8 j, n U- {, b x2 ~ xinput disable <device>8 S# [+ k9 L8 E) k# U& T8 _
xinput enable <device>
" I7 s# E, D( l5 `1 ]分别插入了“wch.cn USB2IIC CTPCONTROL”和“ILITEK ILITEK-TP”两个USB电容触摸屏。! o" a, K/ u. v& }
# V# q! c8 p1 S
forlinx@forlinx:~$ xinput; T7 G- y% a. S6 P
⎡ Virtual core pointer id=2 [master pointer (3)]
) W& g% P% u+ u6 _6 X⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]' e; x+ }' a# k E: Y% |' Z+ a
⎜ ↳ wch.cn USB2IIC_CTP_CONTROL id=9 [slave pointer (2)]5 E- D/ X" ^$ {
⎜ ↳ ILITEK ILITEK-TP id=6 [slave pointer (2)]
# L9 ^& N4 D5 L1 i" v" X4 P B% f⎣ Virtual core keyboard id=3 [master keyboard (2)]
& Q, t* U; }4 U& K ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
( g8 ?9 t% `$ V9 C, q ↳ rk_headset id=7 [slave keyboard (3)]
3 x+ s* P g. z! T4 {" k( a ↳ rk29-keypad id=8 [slave keyboard (3)]' D+ Q' U( t4 W
↳ InputEmulator id=10 [slave keyboard (3)]" j5 y) T8 M2 t# @" M) O. s7 s0 |
双屏异触
, g( i- l6 Z* T4 Z' R* c0 m* Y# T3 `- k- \' g8 F
使用xinput对触摸设备和显示设备进行绑定。ILITEK ILITEK-TP触摸设备的id是6,将其与eDP-1绑定。wch.cn USB2IIC CTPCONTROL触摸设备的id是9,将其与HDMI-1绑定。
/ ?% I6 H, ^5 l' u# i4 F/ B% s! Y% ~, A D& T6 B$ ]
forlinx@forlinx:~$ xinput map-to-output 6 eDP-1
6 j. p; c: s) q: F, B. w8 jforlinx@forlinx:~$ xinput map-to-output 9 HDMI-1
6 ^' D# z- d* F这样就可以实现RK3399下双屏异触了。测试了一下,两个屏幕各自的触摸效果还不错。& _9 ]7 i# ?$ M
0 L! V4 |2 @) A4 |% Q
▼效果如下: H+ x1 [: s5 ]
7 i8 {. D: k$ A" E6 ]. |- a
0
+ ]/ N2 F( ^2 H. R, A) W
0 m9 h% p- M% O. i) {8 q4 j( H
' q: E1 M6 N j' D0 C
* _9 {4 Q9 @( P8 q5 ]7 L |
|