|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
本文以飞凌嵌入式RK3399开发板为基础讲解,主要介绍了Ubuntu系统下双屏显示及异触,其它RK3399平台请参考使用!
- D1 L$ a7 B$ F% \& \7 Lxrandr命令& ^% t1 b& c& _1 o! _: Q" O
“xrandr”是一款官方的 RandR扩展配置工具,它可以设置屏幕显示的大小、方向、镜像等。对于多屏幕显示的情况,可以使用xrandr进行管理。+ [- `. _! r. x, |
+ Q0 M: N0 K5 ]7 Y
, v! P0 E; p9 H4 z# t: J: ~" h
forlinx@forlinx:~$ xrandr --help
8 h3 b/ L3 V. ^4 f/ ]) V8 [( @usage: xrandr [options]
9 C( r9 n0 ]" F, `' m. ^8 M# d where options are:: E O0 o1 ]6 u8 r( e u; m
--display <display> or -d <display>! Y7 \: k8 S |: L1 q
--help
9 h( @* B% S1 v! D" z -o <normal,inverted,left,right,0,1,2,3>
& F) q# Q0 k4 Y" L: U9 t- ?) Z or --orientation <normal,inverted,left,right,0,1,2,3>
7 p3 M1 R% T5 G3 ? -q or --query5 u( I5 c w4 t7 B" I% h
-s <size>/<width>x<height> or --size <size>/<width>x<height>
! P F7 y+ y: f. f/ y6 C -r <rate> or --rate <rate> or --refresh <rate>
" a9 T6 ?! g, h* A9 J: \ -v or --version4 ~9 Z4 c. M9 _- b j
-x (reflect in x)
' r) ^4 u! d# Y, p -y (reflect in y)
+ j/ X7 n) v! p7 w: T --screen <screen>1 Z% V/ w8 h$ B- o" W3 i5 D; v
--verbose
. G9 `* A4 `9 q6 l: h8 |$ i --current
" G# x$ ~1 K, \! b; S1 N3 R! q- p --dryrun6 S# e1 s( \3 \& u* E- H2 C+ g6 q4 \
--nograb, g+ _3 i# C) A8 e1 r' N- i2 L
--prop or --properties3 s K* }" @8 S/ H7 `
--fb <width>x<height>
8 A+ t) y" z( _& [4 L --fbmm <width>x<height>
4 T& e, E/ I5 H1 y4 l/ y --dpi <dpi>/<output>
$ E4 O3 B7 c% u- a/ [ --output <output>7 b* h0 n6 p. ^8 }/ a
--auto
h1 X) \" W0 o! O1 k, q; B --mode <mode>. e. N X- T0 v+ e; i
--preferred
7 ?2 U1 v6 L" _% p* | --pos <x>x<y>: s0 r/ c# Y+ v7 Z* ]0 w/ z
--rate <rate> or --refresh <rate>4 L# \% C# H d, I. q( n
--reflect normal,x,y,xy
- @8 j1 | C9 x+ V8 E! ]1 v) t2 P --rotate normal,inverted,left,right* X. d7 H& n. U
--left-of <output>
" P5 C H5 j$ D# C" E) x% R --right-of <output>
+ a) Z1 E3 B: B --above <output>
% g7 x! \9 k+ m9 b% o+ q+ ~ --below <output>
, j6 ~7 g* N' X --same-as <output>
! u5 G. e( A/ k+ } --set <property> <value>
( O8 B1 v6 _/ o3 O8 ]8 r --scale <x>x<y>, b7 B; o3 a& _( l& l
--scale-from <w>x<h>, \0 V R9 ~) P* [7 K) J' V+ i
--transform <a>,<b>,<c>,<d>,<e>,<f>,<g>,<h>,<i>" i) x2 d4 u, F! Y$ T, Z+ r! ~( s4 ^
--off
' p9 u+ W% T4 n& y& J' q \! u --crtc <crtc>2 x) a: L$ h$ m9 M% F
--panning <w>x<h>[+<x>+<y>[/<track:w>x<h>+<x>+<y>[/<border:l>/<t>/<r>/<b>]]]
& P5 s6 q2 Y' O/ R/ b% O --gamma <r>:<g>:<b>
/ `$ R3 ~$ Z6 Q5 U: ^ K$ Z( x% f8 K --brightness <value>; E9 `" [0 T; p# P3 c
--primary
% J# h# a$ \" ]2 g% S# ]2 B0 _ --noprimary) `7 ]% y/ _. _% ^! B8 \
--newmode <name> <clock MHz>+ a1 V6 o7 h/ \# ^% L. @
<hdisp> <hsync-start> <hsync-end> <htotal>
Y# b! k' m3 r. c% f4 f- v <vdisp> <vsync-start> <vsync-end> <vtotal>
i0 n$ n, |& L4 }0 n( U) C* d [flags...]4 ~9 { p" k* a; D0 J0 A r
Valid flags: +HSync -HSync +VSync -VSync
( {7 e& S% c# V/ U% u; b +CSync -CSync CSync Interlace DoubleScan: ~. X% y9 I2 H5 j1 _8 q; W7 F6 G7 R
--rmmode <name>" u2 |1 r6 a9 O% V
--addmode <output> <name>! o1 l/ B0 _# r/ y
--delmode <output> <name>
* `8 |8 P! x# L1 h" B( I --listproviders! X, A: C$ S- [
--setprovideroutputsource <prov-xid> <source-xid>$ H: C6 c6 C' t% \1 i: t0 Z
--setprovideroffloadsink <prov-xid> <sink-xid>
( x% E: Y- W" _" q --listmonitors
7 n( _1 y! M: `" ?7 w( b' ^ --listactivemonitors$ Q/ r. @6 O1 T% |2 U! t8 G
--setmonitor <name> {auto|<w>/<mmw>x<h>/<mmh>+<x>+<y>} {none|<output>,<output>,...}) r3 A7 ^4 [% c" z6 O* A1 {% v! Q' j
--delmonitor <name>, t6 R* @* X! H
双屏扩展显示 L7 p/ G7 _6 ]- t" ]6 {3 v5 F
5 y# l1 A3 o' f! lOK3399-C Ubuntu系统支持xrandr命令管理多屏扩展显示。同时接入eDP屏幕和HDMI屏幕,系统会默认非热插拔显示设备作为主屏,所以eDP会被识别为primary screen。默认会设置两个屏幕为扩展显示。
* C1 b) l: i( P, I! u3 ?/ z1 ~; N+ o0 s% ^" h0 \1 S2 i3 X
forlinx@forlinx:~$ xrandr( C* N: p5 K- ^: n5 m
Screen 0: minimum 320 x 200, current 2560 x 1440, maximum 8192 x 8192
' \) K ]( y$ c9 `2 K& meDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 276mm x 156mm
- M0 \9 }& A) j0 g 1920x1080 60.00*+4 {* o- r8 `3 r0 w+ t
HDMI-1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
" o7 {" j0 c, s: n5 |( r- X2 w 2560x1440 59.95* + e- A3 p) ^) n! [
1920x1080 60.00 50.00 59.94 7 D$ e. s. A' R! h( X+ ?
1680x1050 59.88
2 e% @$ T p; o( U7 S6 L: ?, G 1280x1024 75.02 60.02
) r! u( k* U9 U3 `; I8 ] 1440x900 59.90
- m; p. z/ m* m: H* W# n9 ^ 1280x960 60.00
$ ]: J4 U' f. |6 m 1280x720 60.00 50.00 59.94 9 j& D% }& A$ p. W. R F/ L
1024x768 75.03 70.07 60.00
5 p0 }% p$ L8 P, F$ \ 832x624 74.55
; V- t* \8 J% {0 o% d 800x600 72.19 75.00 60.32 56.25
$ M$ W4 Q/ z) e* F2 i! T' I2 v5 r 720x576 50.00 % u- w6 [: q: F: R; x! @
720x480 60.00 59.94
3 u! K* Y: p8 [0 S' B, f& ^9 V 640x480 75.00 72.81 66.67 60.00 59.94 & m: ]& f0 C% Q' e J
720x400 70.088 D2 O2 l; j; X3 D' N) B4 C& b; N4 j
可以使用xrandr在两个屏幕中选择哪个做主屏,哪个做副屏。/ t8 z" @/ O+ \8 \6 ~ U' Z2 y9 s
' T2 ~% Q: E5 f/ a7 s# ]) H( s9 ` Z
xrandr --output eDP-1 --right-of HDMI-1 --auto8 M7 b+ I4 }; K/ a
# F9 _9 d m" f
也可以将两个屏幕设置成同显
5 {2 [3 U. l5 C: Q2 o, ]' n. t) O# i: ~" i& q7 e
xrandr --output HDMI-1 --same-as eDP-1 --auto. v! I/ m8 ], Z( e
; M2 E$ M# m( q0 @, _0 C. Y
xinput命令
1 f/ ^% c. a5 `7 R! j* j) Q" v: y% |0 g, A4 B% L
xinput命令用于管理系统的输入设备。+ j1 E/ ^ D" ` N/ v k9 m; i+ o5 h$ }
( l6 ~# i& @4 g2 cforlinx@forlinx:~$ xinput --help
( f% D2 N9 K7 m/ s( ] \4 P' ~4 Ousage : M! w3 O b& j @7 C# i: Y
xinput get-feedbacks <device name>; Y6 Z$ Y) t$ u% U" R9 M1 n
xinput set-ptr-feedback <device name> <threshold> <num> <denom>
" R& _% D7 R' [3 a7 z1 [( k' r. V; X xinput set-integer-feedback <device name> <feedback id> <value>
7 _+ g" |! E) \ xinput get-button-map <device name>, c6 z* p8 p2 s3 C' H$ \6 k% ^( s, ]2 }
xinput set-button-map <device name> <map button 1> [<map button 2> [...]]
- O* }9 h; x5 s0 H1 L5 e/ \! w: g: X xinput set-pointer <device name> [<x index> <y index>]( `( c5 O8 b) R1 x
xinput set-mode <device name> ABSOLUTE|RELATIVE
1 @2 w2 ^" o( x& N+ h7 w xinput list [--short || --long || --name-only || --id-only] [<device name>...]7 w1 Q `0 p" x% E6 g
xinput query-state <device name>
. X" g' t# l2 E- \6 i0 f xinput test [-proximity] <device name>
8 [, {/ C$ k" k6 {8 q$ C2 W xinput create-master <id> [<sendCore (dflt:1)>] [<enable (dflt:1)>]
3 {4 U8 K0 K- Q' P8 ~ xinput reMOVe-master <id> [Floating|AttachToMaster (dflt:Floating)] [<returnPointer>] [<returnKeyboard>]
i% d7 \! v5 W xinput reattach <id> <master>% R2 R; |" u/ c8 H9 Q- J4 {
xinput float <id>
1 w. l2 q" X) e+ ^, K' B xinput set-cp <window> <device>
# N4 X0 g8 ~6 P6 `0 W4 F xinput test-xi2 [--root] <device>2 q" R9 x! m. a( m
xinput map-to-output <device> <output name>
# K0 q& H4 m) [# L* i8 O4 y B xinput list-props <device> [<device> ...]8 R( @ E+ E: I) S
xinput set-int-prop <device> <property> <format (8, 16, 32)> <val> [<val> ...]+ l' t" i! \* V/ W( H4 } c' v
xinput set-float-prop <device> <property> <val> [<val> ...]- F/ e( | K% d$ \# Y
xinput set-atom-prop <device> <property> <val> [<val> ...]
& \( {2 x& M. y; h$ w xinput watch-props <device>0 r6 D0 s, F% o0 w1 t; D
xinput delete-prop <device> <property>
( x3 F( |2 Q4 U: A6 Y xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
& K; |2 ?% O) j8 a1 M# T; g xinput disable <device>
, {' s3 K+ j" Y0 C" N8 L xinput enable <device>
6 h1 x0 j1 l1 | v4 p' k1 ^. O" A分别插入了“wch.cn USB2IIC CTPCONTROL”和“ILITEK ILITEK-TP”两个USB电容触摸屏。
5 [) u+ J) ?5 S' }% [% i8 s5 }
/ ~3 E+ e; i# C. Mforlinx@forlinx:~$ xinput4 L) ?# i0 F5 N9 e
⎡ Virtual core pointer id=2 [master pointer (3)]% A# i/ K: G: ]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]) T! N$ P; u r0 o
⎜ ↳ wch.cn USB2IIC_CTP_CONTROL id=9 [slave pointer (2)]$ k4 @. x5 K i5 }0 _
⎜ ↳ ILITEK ILITEK-TP id=6 [slave pointer (2)]; l6 p6 `2 L( d6 E7 G
⎣ Virtual core keyboard id=3 [master keyboard (2)]
! x9 A- Q, o5 }+ E+ B# ^ ~ ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
7 j9 }. M, K0 {7 Q ↳ rk_headset id=7 [slave keyboard (3)]% J2 c; E- Y! A9 J
↳ rk29-keypad id=8 [slave keyboard (3)]
+ P' F3 R7 v; `+ Q ↳ InputEmulator id=10 [slave keyboard (3)]& Q! t( f" W' ^; r, s/ d
双屏异触
$ v2 M% w: E& e1 [2 ^# X y! U$ w/ D% H# @$ t: z& J
使用xinput对触摸设备和显示设备进行绑定。ILITEK ILITEK-TP触摸设备的id是6,将其与eDP-1绑定。wch.cn USB2IIC CTPCONTROL触摸设备的id是9,将其与HDMI-1绑定。1 N9 s' K* F5 X; h5 R6 h
+ M* v0 _+ t1 N7 Pforlinx@forlinx:~$ xinput map-to-output 6 eDP-12 x7 X& [, ]' G! m- ]# v- f$ Z
forlinx@forlinx:~$ xinput map-to-output 9 HDMI-10 ?/ L6 M% Z$ u, L
这样就可以实现RK3399下双屏异触了。测试了一下,两个屏幕各自的触摸效果还不错。
; i; L0 D9 g9 Z4 t2 n
% I* Z0 }! K. P* ^▼效果如下:
: n' V5 W( P$ e% w- q2 R7 p0 j. P
3 b' O4 w8 r9 r% Y: ~
04 \& e5 g$ F" \+ B
+ l3 ]# M# i% `: i8 E: m( c- ?2 K
% V& L$ O \8 k. [( c
/ ~& x" R$ k% E8 q |
|