|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
本文以飞凌嵌入式RK3399开发板为基础讲解,主要介绍了Ubuntu系统下双屏显示及异触,其它RK3399平台请参考使用!
$ p! l2 x4 S' o$ M4 D7 Sxrandr命令0 W3 i+ \. l' C+ W7 ?0 }
“xrandr”是一款官方的 RandR扩展配置工具,它可以设置屏幕显示的大小、方向、镜像等。对于多屏幕显示的情况,可以使用xrandr进行管理。7 W* ?& @6 O6 ?9 S4 B
& U* X0 C- {( O& M& \
. \* c$ m! z+ @) p; d) p" I
forlinx@forlinx:~$ xrandr --help$ i4 A$ w' L, i9 r( ?8 Y0 i
usage: xrandr [options]' V8 {( c, ^3 e2 X, A+ u
where options are:1 S5 H' ^& d9 d6 r: d$ _
--display <display> or -d <display>
+ L0 Z% f! z" d; @' D --help# B+ A" a! L5 x
-o <normal,inverted,left,right,0,1,2,3>- |4 t' z3 l& p" f$ ?/ N% E" B
or --orientation <normal,inverted,left,right,0,1,2,3>
+ X6 h. b5 [4 r -q or --query
0 H: l" P% i* H/ Y9 a" D, `7 }4 D1 t -s <size>/<width>x<height> or --size <size>/<width>x<height>' _( E, G% |; ]4 V
-r <rate> or --rate <rate> or --refresh <rate>
% p) m% q* F6 i2 R7 S& N( | -v or --version7 [! ~0 ]9 A9 p7 N9 u
-x (reflect in x)& h: W$ t* ~" [. s0 p
-y (reflect in y)4 ~- {# h$ v* n7 R _; N6 Y( _
--screen <screen>
3 G! W+ Z" U2 p, l6 A/ I --verbose
! {+ r6 |" A" D --current
/ x) z" z( E: T* ~: u0 x. T0 ^: p --dryrun0 N K+ v# ^* r. P6 j. Z4 N. {
--nograb5 j9 T. E7 f% U* ?; }$ \1 G* {
--prop or --properties9 B1 H. [# Z$ k2 O3 e2 [' x: M
--fb <width>x<height>
* V9 y, z! r; a# Z- {- ] --fbmm <width>x<height>
$ H7 _ ]0 c# M9 g4 d2 Z! \ --dpi <dpi>/<output>
% @4 C p$ _7 X, n9 z --output <output># r6 o/ f' g$ y+ ^2 r5 p0 R1 F; |
--auto
2 S4 ^' Z# ^6 T --mode <mode>% ?& s- |: U n0 j
--preferred
$ }# p' ^- Q4 L; ] --pos <x>x<y>% d: p9 S1 F( l. ~# M! c
--rate <rate> or --refresh <rate>
6 Y, _$ R+ }! I5 n4 \0 r --reflect normal,x,y,xy. h3 m7 C) x& I2 T7 Z( [4 z& l
--rotate normal,inverted,left,right8 y# |2 y- ~/ b: }
--left-of <output>
0 U8 b6 h. Q$ c. ~ --right-of <output>
0 k3 E" f9 b( m4 z$ L" S --above <output>5 T) t9 q' ]6 K
--below <output>
& P0 z" B4 C9 z/ S Z" @; _: g --same-as <output># ^* |, l ]3 y0 O
--set <property> <value>7 G, ]6 g0 D$ \, S B# s) G
--scale <x>x<y>
8 n1 d# `( ?' m, ?( Q9 u --scale-from <w>x<h>
8 b* \9 v6 K! v9 V; \9 Z+ y --transform <a>,<b>,<c>,<d>,<e>,<f>,<g>,<h>,<i>
3 A4 _9 x$ O, R( o; | --off2 X/ ]' q4 \2 @% K- X3 k( t, `
--crtc <crtc>
( W! C9 [) }7 D3 U# V1 K --panning <w>x<h>[+<x>+<y>[/<track:w>x<h>+<x>+<y>[/<border:l>/<t>/<r>/<b>]]]
% I, S3 X* j2 C. `6 c3 N0 G --gamma <r>:<g>:<b>) E) g8 @% A' ~$ h) |5 ~$ k! u% X
--brightness <value>
* {( f; d @/ e: z' H --primary+ ~ d) {/ h; s6 g7 {) I' ~0 s: L! b
--noprimary
6 J$ D' {% y- Q4 x --newmode <name> <clock MHz>8 {$ j- @4 t. O6 I% Q) J7 O
<hdisp> <hsync-start> <hsync-end> <htotal>4 O# u0 I0 j) r
<vdisp> <vsync-start> <vsync-end> <vtotal>
' Z& [% n9 l) k3 b7 r [flags...]
! u. h" q; b: e, ~3 w" T2 f7 A Valid flags: +HSync -HSync +VSync -VSync
; O, l. T; D+ [6 M +CSync -CSync CSync Interlace DoubleScan
% ~' D0 i$ s) b0 ?3 c% x --rmmode <name>
6 _* B/ T- n- H& p+ k8 K --addmode <output> <name>; \7 m2 h. ~& {# [3 \3 c
--delmode <output> <name>) O. z' @: T. V! q; z
--listproviders4 F9 A# V' C1 \& ]$ G) q. p
--setprovideroutputsource <prov-xid> <source-xid>
2 ]/ p, y* Z8 S8 T9 D6 G) V8 ] --setprovideroffloadsink <prov-xid> <sink-xid>
; K% R) M: a# Y; j --listmonitors; w+ w* h' l1 U" |
--listactivemonitors. U( ~7 s+ Z- J3 w }) i! P$ M
--setmonitor <name> {auto|<w>/<mmw>x<h>/<mmh>+<x>+<y>} {none|<output>,<output>,...}/ G1 U! e# b5 B
--delmonitor <name>. t( f- q% |( G! b
双屏扩展显示
+ s# Q/ N. |/ K0 w
# } ` `+ p# G( QOK3399-C Ubuntu系统支持xrandr命令管理多屏扩展显示。同时接入eDP屏幕和HDMI屏幕,系统会默认非热插拔显示设备作为主屏,所以eDP会被识别为primary screen。默认会设置两个屏幕为扩展显示。7 n6 i' i$ E& n1 [; b7 u
6 J; H5 y; k$ wforlinx@forlinx:~$ xrandr
- B/ N3 @9 w aScreen 0: minimum 320 x 200, current 2560 x 1440, maximum 8192 x 8192: z, n9 U( J/ }% G
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 276mm x 156mm
9 z; _- r/ t F5 l1 ^. V# }9 { 1920x1080 60.00*+
: m9 \* x9 w9 f( BHDMI-1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
0 t3 e$ ]0 Z z6 I+ c+ e 2560x1440 59.95*
2 e* x& L2 @1 { 1920x1080 60.00 50.00 59.94 , j& c1 W8 ~8 m1 @/ w6 ^. O
1680x1050 59.88 # ^" ]$ i; G9 {7 B2 p% F5 C
1280x1024 75.02 60.02 / _: B3 N& i+ g8 g0 ?* }
1440x900 59.90
3 t, s: l- K/ Z! k! _0 x' h8 u$ C 1280x960 60.00 6 b7 E+ V9 x: E. T6 j
1280x720 60.00 50.00 59.94 - B4 t( P) L4 u$ o6 y7 |! v
1024x768 75.03 70.07 60.00 % s. d4 V' T P4 o
832x624 74.55
) P" F! j R2 i) p 800x600 72.19 75.00 60.32 56.25 / p1 a. j& A7 n$ I: v* z
720x576 50.00 % z7 m' E8 v" G: n
720x480 60.00 59.94 $ n1 z. [0 w0 b. f+ T9 ]; h) s
640x480 75.00 72.81 66.67 60.00 59.94
2 u3 G( W9 {- Z) E1 v2 ~ 720x400 70.086 R( e+ b! V! ~1 R
可以使用xrandr在两个屏幕中选择哪个做主屏,哪个做副屏。
( c R5 G+ p4 N; `' s# c
+ r% ~1 N0 j& U6 E' A$ lxrandr --output eDP-1 --right-of HDMI-1 --auto
0 w2 x0 _' f. Q; L
7 }$ u3 P7 a: M% x, k也可以将两个屏幕设置成同显
* J" k! P/ i8 g p7 Q1 f9 E; `& s0 K6 R0 X- E& Q( \
xrandr --output HDMI-1 --same-as eDP-1 --auto5 @5 i# x" D, O! J! u% {
& ]' } v2 V& R- Uxinput命令7 J3 [& u+ Z# Z& [1 |# g# r9 {
- ?; T* Q" F( p' j) G- o) U
xinput命令用于管理系统的输入设备。
6 f6 G6 q" z5 S) J" {% l
& |+ U4 L( k4 d; _8 y* i$ jforlinx@forlinx:~$ xinput --help7 l3 o) e2 V7 P/ e+ S* p# l3 b
usage :
H: O3 C( h9 k$ _ xinput get-feedbacks <device name>+ R0 Q: u* g" a0 a1 X
xinput set-ptr-feedback <device name> <threshold> <num> <denom>
& z0 W7 b0 y/ w8 y% a xinput set-integer-feedback <device name> <feedback id> <value>
3 X* a& w) A4 D+ D8 m xinput get-button-map <device name>
9 J" W: u6 B/ T. j& N ^4 }/ u xinput set-button-map <device name> <map button 1> [<map button 2> [...]]
$ c6 ?5 N2 @) \1 ^0 g; X xinput set-pointer <device name> [<x index> <y index>]% j8 `+ W- x$ x- R2 U
xinput set-mode <device name> ABSOLUTE|RELATIVE
: P) E2 r2 R& Y" G7 i xinput list [--short || --long || --name-only || --id-only] [<device name>...]
& x3 f' z3 S; S: l6 W4 q8 V xinput query-state <device name>) I$ j5 x Z) i1 ^( B
xinput test [-proximity] <device name>9 e U# C1 I: d+ l& x
xinput create-master <id> [<sendCore (dflt:1)>] [<enable (dflt:1)>]( [# M5 F8 u5 B* ]
xinput reMOVe-master <id> [Floating|AttachToMaster (dflt:Floating)] [<returnPointer>] [<returnKeyboard>]
7 e* X4 ]- U0 _8 E8 {5 h, K2 Z xinput reattach <id> <master>
3 ^- k! d2 R1 ^! V# K' Z xinput float <id>
- c9 {! [# X3 |. D/ }1 c% V4 D4 r, } xinput set-cp <window> <device> H4 T' f1 P Q% D: W
xinput test-xi2 [--root] <device>3 {( p; \" R' _
xinput map-to-output <device> <output name>
# a9 t- l4 G, x) m xinput list-props <device> [<device> ...]
: l* z6 y6 w7 b' W7 o xinput set-int-prop <device> <property> <format (8, 16, 32)> <val> [<val> ...]
% e1 v4 i7 t# s& ^* Y xinput set-float-prop <device> <property> <val> [<val> ...]9 t4 S0 C' z+ H( K
xinput set-atom-prop <device> <property> <val> [<val> ...]3 q1 `- I5 V( l* Y8 k% Z
xinput watch-props <device>
: w0 }; E% l: h( T6 H+ F xinput delete-prop <device> <property>
) J) {1 w. t i+ `% W' d7 \3 { xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]7 d* g# z& a: z/ Y3 v6 f
xinput disable <device>, y5 K u/ M/ c% @ J: D8 r1 m
xinput enable <device>/ ?& |2 L G: N; q p+ D
分别插入了“wch.cn USB2IIC CTPCONTROL”和“ILITEK ILITEK-TP”两个USB电容触摸屏。" H2 R$ d# E9 e3 K1 s
9 _" v0 ~' @8 s+ ]4 {' b
forlinx@forlinx:~$ xinput
! u8 z* O' r/ ^! k6 Z" l⎡ Virtual core pointer id=2 [master pointer (3)]% X) M+ ^0 a3 K2 a
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]1 M& K. ]; c. T" m7 j @
⎜ ↳ wch.cn USB2IIC_CTP_CONTROL id=9 [slave pointer (2)]
& G- _2 H$ x9 s' W1 b⎜ ↳ ILITEK ILITEK-TP id=6 [slave pointer (2)]
7 C/ S# {5 S; }; f# d/ o9 D⎣ Virtual core keyboard id=3 [master keyboard (2)]
0 s7 D& c. q9 ` o7 K+ u7 B ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
' x9 V: Z" o# m [$ S ↳ rk_headset id=7 [slave keyboard (3)]7 {) M: h4 B2 h' F4 `+ I
↳ rk29-keypad id=8 [slave keyboard (3)]
7 \2 y, z9 }4 W. f2 K/ j ↳ InputEmulator id=10 [slave keyboard (3)] k% ~) d* k* M2 P5 U
双屏异触" ~" ?2 P4 M& p% `4 L2 Z
' G& z4 r5 J( o9 _2 _. o O
使用xinput对触摸设备和显示设备进行绑定。ILITEK ILITEK-TP触摸设备的id是6,将其与eDP-1绑定。wch.cn USB2IIC CTPCONTROL触摸设备的id是9,将其与HDMI-1绑定。
& _+ ?1 E- I/ c9 o
# j. _- ?# H/ i, r6 c3 R+ n' ^8 gforlinx@forlinx:~$ xinput map-to-output 6 eDP-1: o) h9 w5 {$ t5 D
forlinx@forlinx:~$ xinput map-to-output 9 HDMI-19 p) S$ X6 K) B. N* E5 P4 S: ?
这样就可以实现RK3399下双屏异触了。测试了一下,两个屏幕各自的触摸效果还不错。4 ^7 h- h; t7 v# z M$ O! X6 m
5 m$ o7 c' q0 ]% {8 w▼效果如下:
; B1 J3 g1 X6 @0 ~0 Z% w
+ }; p; Q4 |/ W; O* J) @5 T
0
/ |- M9 w1 w1 b5 O4 ~4 C7 x
9 W: I( X* [9 J0 E4 |0 S+ V+ `; Y. j0 U1 A/ n% u
1 h" k# I2 B M1 x% [4 P# F) h; T
|
|