|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
本文以飞凌嵌入式RK3399开发板为基础讲解,主要介绍了Ubuntu系统下双屏显示及异触,其它RK3399平台请参考使用!
, ? b! X2 f. dxrandr命令
3 r$ w; `* \* j“xrandr”是一款官方的 RandR扩展配置工具,它可以设置屏幕显示的大小、方向、镜像等。对于多屏幕显示的情况,可以使用xrandr进行管理。$ c. `5 M+ S+ H0 p
7 k3 }& w. Z v; g
0 _8 l+ E. }6 Z) l% W r* i( k. qforlinx@forlinx:~$ xrandr --help0 ?# k: h0 m; e& f+ b+ [
usage: xrandr [options]$ J3 J% H5 ~7 d
where options are:
& V: r1 {" |# l; t2 c# R, [- x3 w --display <display> or -d <display>
2 V' S" b+ o3 E2 S+ F! J) Z --help
' O9 F2 P* L# `4 T' g0 O5 j -o <normal,inverted,left,right,0,1,2,3>" S6 Z/ K' I- a- q. ^' @% h
or --orientation <normal,inverted,left,right,0,1,2,3>
; N- \( Q+ }7 F4 @6 w& q -q or --query
5 W9 {2 w4 s: ^9 U: S, g -s <size>/<width>x<height> or --size <size>/<width>x<height>
: d: z! g5 R/ }% Y9 \ -r <rate> or --rate <rate> or --refresh <rate>
6 r5 e0 _: f% L* R* p0 n -v or --version# K+ q+ p6 e) v+ j( j( N
-x (reflect in x)/ y4 f2 s0 U8 e4 R9 d
-y (reflect in y)( [ t% u6 {6 i# f+ P
--screen <screen>
9 p3 w" N9 N( T+ X1 ` --verbose
8 K& S/ E; R4 u' m% G --current
2 g; T3 R% I x; }' A --dryrun
' `$ p; M( r6 w9 s --nograb# p; _3 l% _) x& U1 V2 O7 ?
--prop or --properties
, U% Y/ K0 B6 { --fb <width>x<height>
- J: V" A5 Y% H/ m" { --fbmm <width>x<height>
) v6 ~8 r2 H( Q) w- ^: V$ K' t --dpi <dpi>/<output>
( j0 L5 _1 I% S# M) }0 X1 v1 s& X --output <output>, V, [6 O6 V% G" ^
--auto
2 e* R6 Y Z' D1 A --mode <mode>
+ B6 ^! O8 q. g5 B --preferred
8 J) A) |5 t6 j" K# I! b --pos <x>x<y>+ p ~1 s; R3 Z8 P3 V
--rate <rate> or --refresh <rate>: M* r1 l' i5 K% ^" m. i
--reflect normal,x,y,xy
- K1 n4 }3 M, b# u, H --rotate normal,inverted,left,right2 C, f1 t) @" c9 {6 `
--left-of <output>6 X/ `% Y7 L, c" X3 E. a
--right-of <output>" g* p5 _5 I }, w( h4 N
--above <output>' M3 ~, O( ]/ X1 T) K# Z- z( [
--below <output>
& ^ N8 C" F: s' Q# |9 z --same-as <output>
: o ^/ V4 K2 K( @( ~* s --set <property> <value>5 \) Y% H4 ]/ |: ^ f; `/ Y: ~+ W, `7 T
--scale <x>x<y>
/ D$ o* z" {# E1 l7 W --scale-from <w>x<h>
( N A G0 S. P5 ]- E --transform <a>,<b>,<c>,<d>,<e>,<f>,<g>,<h>,<i>( {4 }. C; o2 o' c! K' L" g
--off
0 n% ?# X- T# ~! Q9 L --crtc <crtc>. `: G* i3 d( D/ V9 p
--panning <w>x<h>[+<x>+<y>[/<track:w>x<h>+<x>+<y>[/<border:l>/<t>/<r>/<b>]]]% a4 H" ?8 t9 N8 h4 M) [
--gamma <r>:<g>:<b>& m8 C9 T1 E. Y' F8 \0 j# j
--brightness <value>9 B& F* ~& C4 e( f6 C
--primary
1 z) B0 A6 K5 o% c5 U --noprimary
# m5 I) z7 v- i7 U4 Z --newmode <name> <clock MHz>
+ v! _& `5 O, L* D/ _ <hdisp> <hsync-start> <hsync-end> <htotal>9 i/ A! p& w, h
<vdisp> <vsync-start> <vsync-end> <vtotal>
% [ w2 l; b0 B* ~: \# A [flags...] }2 b3 a3 \1 L9 {
Valid flags: +HSync -HSync +VSync -VSync! s( z9 h# v6 L; d6 z( V2 y+ s
+CSync -CSync CSync Interlace DoubleScan/ h3 }0 X. e+ B
--rmmode <name>! H+ K5 [% f3 Q- T6 Q/ f3 M7 @4 d
--addmode <output> <name>' ^9 o3 g0 ^0 h* A- w1 `" W/ }
--delmode <output> <name>: d- X4 W4 [" _! v4 I6 z( d+ h6 e
--listproviders
4 r; M O# I8 |% n" M/ [# s --setprovideroutputsource <prov-xid> <source-xid>
9 X' X s0 g W5 R6 n$ ?' f- j7 F --setprovideroffloadsink <prov-xid> <sink-xid>. T2 J s1 c8 X7 j6 A' w' C
--listmonitors; V M8 g% t% a
--listactivemonitors
% _! C2 t% q0 I' u" u --setmonitor <name> {auto|<w>/<mmw>x<h>/<mmh>+<x>+<y>} {none|<output>,<output>,...}# s6 }& @3 D9 i+ f; f* P4 g
--delmonitor <name>
9 f' t- b8 }( T \双屏扩展显示3 y. ^# G; Z& ~1 q# [ C0 _; h, |
/ g1 ^' n. K" p) R! R% g) fOK3399-C Ubuntu系统支持xrandr命令管理多屏扩展显示。同时接入eDP屏幕和HDMI屏幕,系统会默认非热插拔显示设备作为主屏,所以eDP会被识别为primary screen。默认会设置两个屏幕为扩展显示。
% A; T$ E! Y. C2 r. c& z7 g, p1 V$ D. }) C; T
forlinx@forlinx:~$ xrandr9 D: `% w7 T* ~- q) g4 f
Screen 0: minimum 320 x 200, current 2560 x 1440, maximum 8192 x 8192# E4 U/ z+ {3 }/ @
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 276mm x 156mm- r+ v9 K5 r* @( B& M% a5 G
1920x1080 60.00*+0 h$ c7 U o( B0 e) \& @( b
HDMI-1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
9 t0 l8 N9 `% c( l% F8 J/ N5 d 2560x1440 59.95*
- z( e8 e! T9 f# w( [; x1 p k 1920x1080 60.00 50.00 59.94
. y2 E! g+ I! Z 1680x1050 59.88
; s2 S% |0 A, ` 1280x1024 75.02 60.02
/ ^1 { s& ?# w1 { 1440x900 59.90 + y' ~0 ~# y0 a8 _5 k1 e
1280x960 60.00
3 `. G+ T+ ?. F% { 1280x720 60.00 50.00 59.94
. ]4 \. j3 \) t9 U- w 1024x768 75.03 70.07 60.00 3 \4 T( m# @* Q! Q8 X' R
832x624 74.55
* u8 V: w2 r# ?+ P ]; m* ]+ i) p 800x600 72.19 75.00 60.32 56.25
: k2 A, G7 A- V* T( V 720x576 50.00
7 f5 F, b0 D. g# T: k: p 720x480 60.00 59.94
2 g+ L* P, c6 U0 E& ^ 640x480 75.00 72.81 66.67 60.00 59.94
|5 z' @+ T7 _/ M. }4 R 720x400 70.08
& X6 t o D1 Q- `8 h: J可以使用xrandr在两个屏幕中选择哪个做主屏,哪个做副屏。
5 ^4 s: _$ F( e6 T" H; a; L# l' l: t) x4 O6 I. s
xrandr --output eDP-1 --right-of HDMI-1 --auto* u% \' S" \* m! G8 x
) e: T$ `5 r6 z$ E+ ]% o6 P
也可以将两个屏幕设置成同显: C: f* X9 @2 `
' j. i" T; c% E/ _6 `
xrandr --output HDMI-1 --same-as eDP-1 --auto
' g5 B' ^4 B4 }- d d
1 O. f# Q2 u) i' P# \xinput命令
8 `1 B% ~; C1 }+ j2 E8 [8 } y7 v- i% j1 r
xinput命令用于管理系统的输入设备。
4 V! z8 g9 u; V N5 w8 m. D& w8 W; i4 n
forlinx@forlinx:~$ xinput --help
! e' j( J3 U- b' S7 Ausage :
% b8 B2 [! J7 t3 _9 Z, H( j xinput get-feedbacks <device name>
' V) ~- H" s# g, l: D I xinput set-ptr-feedback <device name> <threshold> <num> <denom>) ~3 w9 A/ J9 G' p3 Q# x7 q
xinput set-integer-feedback <device name> <feedback id> <value>
, o# [+ M; j- _. \ xinput get-button-map <device name>% ~4 U5 l! w9 x8 X/ Y* V
xinput set-button-map <device name> <map button 1> [<map button 2> [...]]
6 i4 `$ H; `8 v* |0 o9 `/ s xinput set-pointer <device name> [<x index> <y index>]/ B+ q3 K ]" j4 T7 ]& I: k# x
xinput set-mode <device name> ABSOLUTE|RELATIVE( z- f( v/ S% x+ ^, p
xinput list [--short || --long || --name-only || --id-only] [<device name>...]6 }3 S& F8 u: Y% R
xinput query-state <device name>6 x# d- W: H6 a
xinput test [-proximity] <device name>( [3 }# Z* X7 A4 g$ h" t0 i8 o
xinput create-master <id> [<sendCore (dflt:1)>] [<enable (dflt:1)>]
6 x" Q$ |2 D! Q$ [ xinput reMOVe-master <id> [Floating|AttachToMaster (dflt:Floating)] [<returnPointer>] [<returnKeyboard>]
+ H$ z+ [4 j8 V, `1 Q xinput reattach <id> <master>
0 E2 v( X" ^0 Q xinput float <id>4 [( ?# K e+ h$ m" ^; x
xinput set-cp <window> <device>
- s" l0 E. e: w" J I: C% c9 ^ xinput test-xi2 [--root] <device>
3 e2 J! O1 n$ c. u2 _" x xinput map-to-output <device> <output name>6 _, n, H6 e- C7 G# J; z+ u$ p
xinput list-props <device> [<device> ...]: B/ T: ~% W1 e. W
xinput set-int-prop <device> <property> <format (8, 16, 32)> <val> [<val> ...]
2 |+ D) T1 O1 U xinput set-float-prop <device> <property> <val> [<val> ...]
; ]- B) O' u8 c1 g' m xinput set-atom-prop <device> <property> <val> [<val> ...]
6 D3 T, x6 ?8 V* }6 P. ]3 V. q xinput watch-props <device>
5 U% T4 b w8 E! U$ r) [# W: j xinput delete-prop <device> <property>
) O& n' |5 m' Y8 K" K# k! R xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
' y8 H9 J6 R6 o" s! A. M8 U5 _ xinput disable <device>
1 A9 w4 M) m6 Z) A2 A. ]0 B xinput enable <device>
% O. l o/ `! u0 B9 j* }3 e$ Q分别插入了“wch.cn USB2IIC CTPCONTROL”和“ILITEK ILITEK-TP”两个USB电容触摸屏。! ^3 ]: P$ G, `: [ P
+ E& c- S/ F8 ~ Uforlinx@forlinx:~$ xinput
: k1 s9 _8 t6 U6 p3 @" ^⎡ Virtual core pointer id=2 [master pointer (3)]
|5 u' T$ }, _! J3 p- r" w# \⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]$ Z/ e- _0 t! t% q5 _
⎜ ↳ wch.cn USB2IIC_CTP_CONTROL id=9 [slave pointer (2)]! V& s d7 `( q' B Q; D: z+ ~
⎜ ↳ ILITEK ILITEK-TP id=6 [slave pointer (2)]& U4 e& t* {8 H8 h8 r
⎣ Virtual core keyboard id=3 [master keyboard (2)]
. l0 _6 ]8 M& k0 m" v+ ~ ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
0 y0 z1 E0 |6 v- m! i& b" j/ H f ↳ rk_headset id=7 [slave keyboard (3)]8 Z3 S$ b4 |) Y6 K* M; Q
↳ rk29-keypad id=8 [slave keyboard (3)]* k* O2 N8 a0 s
↳ InputEmulator id=10 [slave keyboard (3)]1 V+ I: U$ w' N+ H/ u. ?2 {
双屏异触
4 H* }" U4 }+ O: J( @- y# r( F' ~5 H5 ]
使用xinput对触摸设备和显示设备进行绑定。ILITEK ILITEK-TP触摸设备的id是6,将其与eDP-1绑定。wch.cn USB2IIC CTPCONTROL触摸设备的id是9,将其与HDMI-1绑定。2 f9 v. V2 Q1 r' Q( O
- F( X1 x: U; W7 A5 }. S* i) Cforlinx@forlinx:~$ xinput map-to-output 6 eDP-1
( n. j& n9 p5 X; E7 o! @5 ^forlinx@forlinx:~$ xinput map-to-output 9 HDMI-18 h" y3 C- q0 L* o
这样就可以实现RK3399下双屏异触了。测试了一下,两个屏幕各自的触摸效果还不错。3 n% {* r" |/ @" S1 N, q7 d
$ B E; H. f( n( F) m
▼效果如下:
$ P4 G# m+ L% m! }% Y
, I, I z; a4 c6 g! G) A/ g
0. e# {* Y! P. c; L" T: l( Q# j
, v; |! l- g& ^: J# t* K5 p+ f, Z+ G6 X5 ^+ Q) h5 o B
1 D, B. O- N1 F7 ?" u
|
|