|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
本文以飞凌嵌入式RK3399开发板为基础讲解,主要介绍了Ubuntu系统下双屏显示及异触,其它RK3399平台请参考使用!
- J3 b; l' N* N# { U* G+ uxrandr命令
_: }2 V9 q) [1 J+ m' W“xrandr”是一款官方的 RandR扩展配置工具,它可以设置屏幕显示的大小、方向、镜像等。对于多屏幕显示的情况,可以使用xrandr进行管理。
0 P: i7 Z, m9 `& G" x5 ^; L
+ o, c7 E$ g: \* U$ ~% }+ V5 I9 r* b. r. K5 o( H
forlinx@forlinx:~$ xrandr --help. a5 ~, Q4 n1 Q" v. f u
usage: xrandr [options]) O# ~& H) H# I' Y) Z! H0 D
where options are:& S$ Y6 g/ A2 d3 X( W. v9 n: s3 T4 @
--display <display> or -d <display>
; [3 }' s1 [" J! q; C --help3 C1 I: V; _9 j7 R1 X" G
-o <normal,inverted,left,right,0,1,2,3>% G5 ^& ~" f& Z$ o
or --orientation <normal,inverted,left,right,0,1,2,3>
0 v3 l1 K; p+ V4 n -q or --query9 c6 k4 S- j- Y+ `8 `
-s <size>/<width>x<height> or --size <size>/<width>x<height>
9 b2 P4 A4 g7 B0 w -r <rate> or --rate <rate> or --refresh <rate>
7 x1 A" q. Y! ?! c2 w* r -v or --version; F# t: p, K7 r4 T/ A) c2 w
-x (reflect in x)
4 c- r( d W1 x/ {' S -y (reflect in y)
( }7 R3 Z8 Z) K5 |" q7 L/ c/ d$ x --screen <screen>
/ j6 l" H/ ~/ I! z8 c) W8 f --verbose0 ~, e, g& B, x9 G9 M
--current. \) T7 k- M1 H: p
--dryrun
3 x/ ?8 a0 ]! P' k3 T --nograb
' g5 f' Z* r( K2 e% i --prop or --properties
# u9 C2 x- G) {2 J& E6 z- v; ` --fb <width>x<height>2 A" Q$ p1 M0 a$ Y3 k D
--fbmm <width>x<height>3 n( }0 }* t) S/ S8 q* n9 t' j0 e" a
--dpi <dpi>/<output>
3 _3 @- j& @0 \: r: L# q' j --output <output>- I8 }6 j& I( y/ G; a) S& g j
--auto5 w' e3 F" x. [
--mode <mode>
7 i* b5 j$ q) c+ ~- S5 U --preferred6 `" X0 P% h/ S& m4 @: ]: [) X# G
--pos <x>x<y>
! g) Z7 @, V! x+ j7 j" ^2 m7 Q --rate <rate> or --refresh <rate>: `$ C: j. O4 Z; u
--reflect normal,x,y,xy; P& _- z1 H7 m: Z
--rotate normal,inverted,left,right
! U* d) l0 f1 X4 o7 }& c --left-of <output>
/ h, L. Q5 ~% u! T/ ]$ W6 C3 e --right-of <output>
, E8 W; k2 q2 Y8 N& D --above <output>
& R! A: k! S A$ A( P6 F. | --below <output>
, ~3 c8 Y6 v @: v2 P9 s --same-as <output>' d& s- m, L8 h `
--set <property> <value>$ `+ ?0 Z0 g$ q X- N4 m c/ U
--scale <x>x<y>
f7 ^7 c D" c, ] --scale-from <w>x<h>$ ^* N7 y7 Y8 V2 A3 X) a- x. A/ }
--transform <a>,<b>,<c>,<d>,<e>,<f>,<g>,<h>,<i>
; Q# d2 n& q- s. C W" C --off
% j" j0 ^. i7 U; ? --crtc <crtc>
) A$ w# U$ D [( y, ?; \3 Q --panning <w>x<h>[+<x>+<y>[/<track:w>x<h>+<x>+<y>[/<border:l>/<t>/<r>/<b>]]]1 c( R! Z( c5 T, F1 n. u
--gamma <r>:<g>:<b>
% R! O7 V( `1 p5 ]; u ~: H9 | --brightness <value>! ?7 j6 Y1 H' \/ F3 [
--primary9 H- T5 O+ X# g- i( Z R q* p- h+ f
--noprimary
K, Q: a/ P9 M, L --newmode <name> <clock MHz>( t! p) ~9 C) X. c
<hdisp> <hsync-start> <hsync-end> <htotal>
1 [2 |3 _. u$ X, J <vdisp> <vsync-start> <vsync-end> <vtotal>
6 c/ ^; k$ I5 `1 [4 V; z [flags...]2 @9 H9 |# _% M" j
Valid flags: +HSync -HSync +VSync -VSync% F, {; q2 C6 x, \5 C
+CSync -CSync CSync Interlace DoubleScan7 M$ n& ?; ~9 r5 E% s9 e- n3 a; U
--rmmode <name>
2 o, Z3 p3 U+ a' }7 U --addmode <output> <name>
( d! l; V+ v$ S3 Q$ s b --delmode <output> <name>
: H/ K/ C5 y1 y& ?( q; X D --listproviders6 H" f, O! T& V W5 N+ p. m
--setprovideroutputsource <prov-xid> <source-xid>
6 E! W2 h- x# p --setprovideroffloadsink <prov-xid> <sink-xid>
3 n6 S/ y- \( q& a- p! n& k --listmonitors
2 y+ I' W' K4 v% |0 S: X) E --listactivemonitors
. u" x1 E) H- Q# ~ --setmonitor <name> {auto|<w>/<mmw>x<h>/<mmh>+<x>+<y>} {none|<output>,<output>,...}
% u, _, C I& r1 `* D7 m9 v --delmonitor <name>' V/ L! Y8 x6 K V$ g
双屏扩展显示% C' Y. O; \0 \5 X) E$ T% I* Q( r, T
! W1 l0 i; H7 X p* B* r* ?5 ~
OK3399-C Ubuntu系统支持xrandr命令管理多屏扩展显示。同时接入eDP屏幕和HDMI屏幕,系统会默认非热插拔显示设备作为主屏,所以eDP会被识别为primary screen。默认会设置两个屏幕为扩展显示。, f/ X9 n2 H) a; u+ a9 i) T
2 K8 M" y* Z2 z3 A: _
forlinx@forlinx:~$ xrandr; \! I; c8 V. U
Screen 0: minimum 320 x 200, current 2560 x 1440, maximum 8192 x 8192. ?5 J$ z: f1 g* Z0 F, s
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 276mm x 156mm
3 M' e* c6 t/ A: X 1920x1080 60.00*+
O0 K) ~9 \' C( a" E6 YHDMI-1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
9 U, H& \, d9 g( ?4 V M0 y 2560x1440 59.95* & O. A# S3 j0 Y3 ^/ [
1920x1080 60.00 50.00 59.94 8 m9 \# Y9 O. F9 i
1680x1050 59.88 ( b( U) P" e2 S
1280x1024 75.02 60.02
% G6 X& e4 g1 P( R7 p' ^% ~2 C 1440x900 59.90
1 [: D' {+ _. m9 ?: P% N" q' M 1280x960 60.00
; u' A! F1 }$ R8 @ 1280x720 60.00 50.00 59.94
: e, R/ y7 R6 K! j2 {; | 1024x768 75.03 70.07 60.00
5 n8 S) e9 W+ h* |( _ 832x624 74.55 . U! D/ L! m8 g* |; Y
800x600 72.19 75.00 60.32 56.25
: }: ~- i3 I; t4 l7 Z 720x576 50.00 # P7 q. N% a2 {" g: {3 L+ U8 Q6 X
720x480 60.00 59.94
7 X, L9 l/ \8 L4 Q, \. }. ? 640x480 75.00 72.81 66.67 60.00 59.94
/ z" E6 @, z T! ~1 b9 M+ m 720x400 70.08& S3 K, Z" P; a; s0 [
可以使用xrandr在两个屏幕中选择哪个做主屏,哪个做副屏。# i" ?- g0 }7 G- Y+ b
0 {. `% H/ O% e w6 lxrandr --output eDP-1 --right-of HDMI-1 --auto& L: t( G8 {+ Z, t4 C
- F8 {8 o& K' k5 s- n9 ^$ |也可以将两个屏幕设置成同显
$ [. s6 B$ h$ a, q# I9 ^& F; R1 \, h1 W; G- b5 c
xrandr --output HDMI-1 --same-as eDP-1 --auto6 T1 b! W. ~1 }6 v% Y9 l9 N5 N6 ^
1 d. T3 P% ~& axinput命令
& Y! ^5 D+ V/ g
+ @4 g ~& X( h6 F6 \xinput命令用于管理系统的输入设备。9 P- k/ u+ c: `( B
Y0 B" n7 O% Y$ B/ qforlinx@forlinx:~$ xinput --help& h# E" c4 g8 O" s' R
usage :: P# o( v/ C# ` T- K
xinput get-feedbacks <device name>/ D: M. V9 b% ]2 U( L
xinput set-ptr-feedback <device name> <threshold> <num> <denom>
% T$ p. }' }4 P \. c G2 u xinput set-integer-feedback <device name> <feedback id> <value>
- E2 k" D% B7 T l7 R xinput get-button-map <device name>" L% f# \; V9 d O7 R, W
xinput set-button-map <device name> <map button 1> [<map button 2> [...]]
% s3 F# k `: Y: a xinput set-pointer <device name> [<x index> <y index>]" S0 {. \& v& {9 \6 z# M6 l, g$ ^
xinput set-mode <device name> ABSOLUTE|RELATIVE2 d. P5 X. y. Q9 ^* I1 v% o* g& T
xinput list [--short || --long || --name-only || --id-only] [<device name>...]+ b ~1 O/ C. y; l5 \2 Z; P5 j$ Y
xinput query-state <device name>. j u; n7 W L1 {4 Q
xinput test [-proximity] <device name>
( I( h9 Z* d' ~8 ^6 Z xinput create-master <id> [<sendCore (dflt:1)>] [<enable (dflt:1)>]
4 E/ k& n* U8 A& p _$ p xinput reMOVe-master <id> [Floating|AttachToMaster (dflt:Floating)] [<returnPointer>] [<returnKeyboard>]
; } N X- Z5 b' W/ ^) I8 q xinput reattach <id> <master>
/ D6 \' m3 h0 b xinput float <id>
3 h+ k- J& c9 j' x, l! g xinput set-cp <window> <device>9 {) x9 ~2 R) D; w6 ~4 v- t
xinput test-xi2 [--root] <device>
! E: [ N0 ~ h1 H9 j# ]* y$ f xinput map-to-output <device> <output name> c O K" w0 ]) P! M# K
xinput list-props <device> [<device> ...]" a3 ~7 G$ z# f- r
xinput set-int-prop <device> <property> <format (8, 16, 32)> <val> [<val> ...]' m7 O% C( X! I% T
xinput set-float-prop <device> <property> <val> [<val> ...]
$ ^% }, d3 M4 D7 m1 K6 H7 ] xinput set-atom-prop <device> <property> <val> [<val> ...]* G+ T Q) D" M/ t0 y
xinput watch-props <device>
! p4 _0 a7 N9 h- G! l, w2 Z xinput delete-prop <device> <property>3 V- a; i0 o. F8 Q3 w
xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]( u+ A8 D4 B, l# o3 ?
xinput disable <device>
3 k% U7 [3 @9 b xinput enable <device>
4 c( S4 `( I+ I) b分别插入了“wch.cn USB2IIC CTPCONTROL”和“ILITEK ILITEK-TP”两个USB电容触摸屏。
* x# d( I p k$ H* w& F) S3 X/ r8 U% }4 {$ Q
forlinx@forlinx:~$ xinput) _1 E5 f9 w* g& c
⎡ Virtual core pointer id=2 [master pointer (3)]! p! L0 W, S; I/ l: e9 H
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
0 a* ?4 m' y! m8 z( f/ U3 j7 u; Y T⎜ ↳ wch.cn USB2IIC_CTP_CONTROL id=9 [slave pointer (2)]( l: y8 ]0 D" P; r
⎜ ↳ ILITEK ILITEK-TP id=6 [slave pointer (2)]' X, F. ^- o7 U& t1 T$ }
⎣ Virtual core keyboard id=3 [master keyboard (2)]/ b6 E0 s1 K5 }8 k1 p: o$ y+ c7 h
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
# [! {% s, ? s, f/ v0 o2 a% J, j ↳ rk_headset id=7 [slave keyboard (3)]- ?8 Z J5 Y7 T% I3 \- b
↳ rk29-keypad id=8 [slave keyboard (3)]
$ O. p" B$ [4 p$ m) ?6 N" E/ R8 q ↳ InputEmulator id=10 [slave keyboard (3)]
) v- B% ^1 P7 v4 m' Q双屏异触
; L3 p2 K- d( c" m/ `0 H/ w4 |/ x" {; S7 `
使用xinput对触摸设备和显示设备进行绑定。ILITEK ILITEK-TP触摸设备的id是6,将其与eDP-1绑定。wch.cn USB2IIC CTPCONTROL触摸设备的id是9,将其与HDMI-1绑定。" F& {) c8 L" F' n6 ^$ c
4 u7 q1 A# k8 c% v3 v
forlinx@forlinx:~$ xinput map-to-output 6 eDP-1
$ x* i- V! g1 n8 yforlinx@forlinx:~$ xinput map-to-output 9 HDMI-1
- Y1 @4 e8 P) [这样就可以实现RK3399下双屏异触了。测试了一下,两个屏幕各自的触摸效果还不错。8 D- j% @7 B* s$ g
. z& c& F* `8 u- f5 g▼效果如下:. `. x3 `+ a7 ^& P( p( {% L6 |$ V# j
6 w/ I: g7 T* P1 a
0
# }' ^$ W" ~: H
C9 m! \; C$ O% J& ]# P' | ~$ w
+ S. J" y1 Q8 F$ Y, V& Z; g6 o3 a8 K0 y) [" S0 G5 q- h
|
|