EDA365电子论坛网
标题:
RK3399开发板Ubuntu系统下实现双屏显示&异触
[打印本页]
作者:
Maskman
时间:
2022-8-11 10:06
标题:
RK3399开发板Ubuntu系统下实现双屏显示&异触
本文以飞凌嵌入式RK3399开发板为基础讲解,主要介绍了Ubuntu系统下双屏显示及异触,其它RK3399平台请参考使用!
d6 f6 \, S' z
xrandr命令
: ^% w) F) _: i w( F8 x
“xrandr”是一款官方的 RandR扩展配置工具,它可以设置屏幕显示的大小、方向、镜像等。对于多屏幕显示的情况,可以使用xrandr进行管理。
) }0 H. G* o5 C D" o
/ [. T' K/ N) I( V
* c, ^5 R) P+ Y! q+ n( x' I' ^. m
forlinx@forlinx:~$ xrandr --help
. D' j9 O( d, Q
usage: xrandr [options]
& ^! H+ |6 r/ a4 Z# t0 z
where options are:
" O4 Y+ }; [* _/ s! p0 v( v6 x0 x: p
--display <display> or -d <display>
% U! T" N6 X' Q1 f* B
--help
: R3 z$ Q3 z3 Q$ A, q0 l8 b
-o <normal,inverted,left,right,0,1,2,3>
+ a$ c: J+ q1 w( @
or --orientation <normal,inverted,left,right,0,1,2,3>
$ c- [4 Z! G% R! y
-q or --query
8 h, n4 \1 ] O6 G1 N9 m
-s <size>/<width>x<height> or --size <size>/<width>x<height>
0 I D0 C& J# b' Q
-r <rate> or --rate <rate> or --refresh <rate>
1 O) d8 B* Z( k8 G+ _4 g
-v or --version
4 K! x: H3 M8 s+ B
-x (reflect in x)
4 V3 I. Y, O2 C
-y (reflect in y)
2 g v# ?3 g6 Y9 @: R
--screen <screen>
' E/ Z" s: q& y
--verbose
' H5 [4 e) z/ _3 S& v& ~
--current
3 J! k9 {/ b% j. N
--dryrun
6 A" ?' z" ~% @: w' o# I4 C' I- y
--nograb
6 v# s: W I6 W/ X, V/ U" b( T5 J
--prop or --properties
# T7 S+ B8 g* p" }% ^
--fb <width>x<height>
R) j) T, J9 Y- ` b0 {
--fbmm <width>x<height>
/ `) j/ T$ Y, a& {8 N
--dpi <dpi>/<output>
6 r d: s3 w3 J# e; X. D6 P! r
--output <output>
8 g* r- F0 p7 f( A: \
--auto
# W$ i" r- j* x6 |1 y8 e% E
--mode <mode>
4 }- \- M. ^' ^1 ?9 U- b x# [
--preferred
; }$ Z- l9 j. t! K
--pos <x>x<y>
e/ v' l0 R/ q- @# `
--rate <rate> or --refresh <rate>
$ Y2 u7 F& L, d
--reflect normal,x,y,xy
9 r7 [# F) k, ], W, C5 @ ^
--rotate normal,inverted,left,right
+ u7 D4 [# h/ a7 b
--left-of <output>
/ i! w0 a, R! ~0 w
--right-of <output>
- w! O4 |/ G) k1 Y; t$ b* @- `
--above <output>
4 w. J x9 e$ S" n; m8 D5 c
--below <output>
3 k6 R" P( T3 j6 j$ ]: w. ~) g4 s, n
--same-as <output>
9 `0 I0 x2 R% R B6 `, A& ]# @
--set <property> <value>
6 e `0 k7 p8 C5 f1 I& I6 m
--scale <x>x<y>
* d. p# ^! G: v s o
--scale-from <w>x<h>
% X4 T& g" m1 ?0 P' P; w0 s. ]
--transform <a>,<b>,<c>,<d>,<e>,<f>,<g>,<h>,<i>
' @7 x% `* J0 W) {: B4 E" A
--off
" W1 C& U* Q9 r8 T
--crtc <crtc>
; c' j6 n' Y* ?) }' A' x: s
--panning <w>x<h>[+<x>+<y>[/<track:w>x<h>+<x>+<y>[/<border:l>/<t>/<r>/<b>]]]
- e* x# T8 ?3 ^" E: T" z8 ~
--gamma <r>:<g>:<b>
: R$ `% G4 n# Q
--brightness <value>
1 m; t$ J+ t! c% f; }' c5 \2 m
--primary
6 a3 V5 v" ?5 A; l
--noprimary
1 m; K9 P- v2 l3 y
--newmode <name> <clock MHz>
! S0 P& c" y& j6 X) n
<hdisp> <hsync-start> <hsync-end> <htotal>
6 b& J8 C1 i5 @3 w6 h: U7 g& M% y
<vdisp> <vsync-start> <vsync-end> <vtotal>
) L; c K* D& s; r( A$ A1 v
[flags...]
0 z8 Q8 X, h$ a* Y1 A/ W4 S: Q
Valid flags: +HSync -HSync +VSync -VSync
" ~4 Y" @. O2 C y: [' _9 i
+CSync -CSync CSync Interlace DoubleScan
* M8 M2 o7 w8 @$ n4 j4 K+ a) l* R# x
--rmmode <name>
4 p# B0 e Z2 m T6 Q0 X
--addmode <output> <name>
& B4 |5 f% ?/ r
--delmode <output> <name>
7 g; j7 \) e0 B, v, N( O
--listproviders
9 b1 W& ~& {; k4 { C
--setprovideroutputsource <prov-xid> <source-xid>
4 h# k2 v# ^5 c2 \1 q- R
--setprovideroffloadsink <prov-xid> <sink-xid>
z7 g1 S) W* k# Z1 z+ Q: D
--listmonitors
% c9 U6 }) R, E: s/ V- O. i* f3 n
--listactivemonitors
$ s; S# Z, U5 M" \' E
--setmonitor <name> {auto|<w>/<mmw>x<h>/<mmh>+<x>+<y>} {none|<output>,<output>,...}
; S& R" I# e- e5 y6 R3 H
--delmonitor <name>
0 |' v0 ]& D" b/ x) c
双屏扩展显示
: _8 g* E6 P# Z1 X$ z, z* I% X
( E" I4 l. d; i7 S2 X
OK3399-C Ubuntu系统支持xrandr命令管理多屏扩展显示。同时接入eDP屏幕和HDMI屏幕,系统会默认非热插拔显示设备作为主屏,所以eDP会被识别为primary screen。默认会设置两个屏幕为扩展显示。
$ | r, m6 d: }+ W+ n
5 c( V+ @. E- U" N m. S& T
forlinx@forlinx:~$ xrandr
2 q# e9 C* g* Y; t# H
Screen 0: minimum 320 x 200, current 2560 x 1440, maximum 8192 x 8192
8 [6 I3 x; Q& Y, ~; z3 u4 Q
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 276mm x 156mm
0 B, T' [' \1 R+ U
1920x1080 60.00*+
6 c# _" D/ Y8 w
HDMI-1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
9 Y! U) ~9 E: M+ }: `
2560x1440 59.95*
( G+ K' j4 K% ]: z( L; k
1920x1080 60.00 50.00 59.94
0 c: ^2 o& ?8 k6 C4 {- J8 h1 [+ @: B
1680x1050 59.88
# Y- b: h6 S% U: G: k) k- D
1280x1024 75.02 60.02
9 U4 |6 u' @9 @8 _) `# u
1440x900 59.90
0 s, K, t0 ^7 u2 l$ o4 \% @# I
1280x960 60.00
5 i+ e8 m+ R; Z/ A8 j
1280x720 60.00 50.00 59.94
q6 K7 e0 m0 M# S# v$ e
1024x768 75.03 70.07 60.00
7 V# `& q9 ~; j {; a
832x624 74.55
# e$ m2 Z5 b0 _0 e2 D' }8 Z
800x600 72.19 75.00 60.32 56.25
' ^/ x9 F2 L0 U) r
720x576 50.00
* j7 _) k. g: u- T3 C; m
720x480 60.00 59.94
/ H5 s# k; @' A' l* ]1 ~# @# ~; K4 C
640x480 75.00 72.81 66.67 60.00 59.94
$ b# `4 g- U: l" C
720x400 70.08
+ u: g R5 W' M
可以使用xrandr在两个屏幕中选择哪个做主屏,哪个做副屏。
! ]3 G+ P, Z* V8 p3 a
/ J5 m1 ?, p# J. M9 \
xrandr --output eDP-1 --right-of HDMI-1 --auto
' T! i, R# {% @7 |& _* [$ S& ]
+ x, O, L; j$ }" P' K5 U2 e
也可以将两个屏幕设置成同显
* O/ `+ m7 A9 H# `. ^
/ H4 d" t5 t2 e+ B1 q7 j8 q9 n) N% O
xrandr --output HDMI-1 --same-as eDP-1 --auto
7 @4 r5 L5 e% P( c3 l8 [
5 o7 H8 V2 \5 e/ l6 l; P
xinput命令
; i( ^! i8 O/ r
$ O* {8 g$ L# ?) o0 L$ M6 A% x
xinput命令用于管理系统的输入设备。
' i4 S" q& o: S8 k p2 R
0 o) K, S8 {3 ^
forlinx@forlinx:~$ xinput --help
8 X3 \) z3 x4 d+ ?! w
usage :
8 {6 }; v! U9 k- d$ |( ~# Y
xinput get-feedbacks <device name>
# _# L0 x! B- S) u( r7 q" q
xinput set-ptr-feedback <device name> <threshold> <num> <denom>
" w7 \8 X+ |: P! M9 L8 b1 `) l
xinput set-integer-feedback <device name> <feedback id> <value>
& W+ Q" [2 X! |/ }
xinput get-button-map <device name>
j( Q# @* @* i N' ^
xinput set-button-map <device name> <map button 1> [<map button 2> [...]]
2 j7 z) R/ K; [; e2 O
xinput set-pointer <device name> [<x index> <y index>]
: F; X1 z8 Z6 |) _& D! U$ @& Y R
xinput set-mode <device name> ABSOLUTE|RELATIVE
+ y3 Z9 \' h; Z& w7 O
xinput list [--short || --long || --name-only || --id-only] [<device name>...]
5 l: h" L. r- S" ]5 v
xinput query-state <device name>
/ u: ~& S. _$ {2 S! C4 u! z
xinput test [-proximity] <device name>
# p4 a) b, G* s. B* F) c
xinput create-master <id> [<sendCore (dflt:1)>] [<enable (dflt:1)>]
* U, y% m$ ^8 z- _: i% X
xinput reMOVe-master <id> [Floating|AttachToMaster (dflt:Floating)] [<returnPointer>] [<returnKeyboard>]
1 z2 N# m7 V: V+ X6 n- o* S1 `! o
xinput reattach <id> <master>
' F" ?! y+ C: P* N, S' p
xinput float <id>
& [# J2 m' b8 Y. B
xinput set-cp <window> <device>
0 l3 @' I' e; H6 L, o0 a; {3 V
xinput test-xi2 [--root] <device>
+ i$ a: Z# V; Y& P- d% K0 l7 V7 O
xinput map-to-output <device> <output name>
* j* A( m) j% x2 o @
xinput list-props <device> [<device> ...]
3 U7 B5 r3 N0 ~9 P
xinput set-int-prop <device> <property> <format (8, 16, 32)> <val> [<val> ...]
! `7 ~+ i% ^ B' G1 S1 A9 _# E; s
xinput set-float-prop <device> <property> <val> [<val> ...]
; d. K. x/ r0 I. d7 c
xinput set-atom-prop <device> <property> <val> [<val> ...]
" @% a. V) J) k2 z% A1 R) a1 _& S3 |4 @
xinput watch-props <device>
7 d: V& L- h- W0 R& m3 ?# `
xinput delete-prop <device> <property>
, V. | | v& s5 M3 u" s- o8 g) d# r- K
xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
. F- u! v p3 i* t7 M
xinput disable <device>
5 d3 G. A/ ?* d' ~4 c$ X
xinput enable <device>
. C/ Q$ e! _5 @5 Z. @6 ^
分别插入了“wch.cn USB2IIC CTPCONTROL”和“ILITEK ILITEK-TP”两个USB电容触摸屏。
; ]! P3 L. Y# n5 x9 R# |' `
6 B, R7 B/ a0 X; b3 x8 y2 W9 E
forlinx@forlinx:~$ xinput
9 x, I8 f( U: n- p8 J
⎡ Virtual core pointer id=2 [master pointer (3)]
/ E# _$ q3 Y/ o
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
Z% N( W: _" ~$ C# L
⎜ ↳ wch.cn USB2IIC_CTP_CONTROL id=9 [slave pointer (2)]
( ^9 r/ Y, X+ O; Q* _& e
⎜ ↳ ILITEK ILITEK-TP id=6 [slave pointer (2)]
7 ^; h1 ?8 I& H' ^ y
⎣ Virtual core keyboard id=3 [master keyboard (2)]
2 c. K# ~' w5 @9 u% f7 B, r
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
/ y5 U ~' X1 a" S
↳ rk_headset id=7 [slave keyboard (3)]
3 S7 t6 U1 k. y: n4 [& c8 |- l0 S
↳ rk29-keypad id=8 [slave keyboard (3)]
$ R/ d0 `$ c# H3 m" F
↳ InputEmulator id=10 [slave keyboard (3)]
/ v8 b F/ }* W4 V5 f
双屏异触
4 @; y- X; [3 |
. U9 |5 k1 H; t9 S
使用xinput对触摸设备和显示设备进行绑定。ILITEK ILITEK-TP触摸设备的id是6,将其与eDP-1绑定。wch.cn USB2IIC CTPCONTROL触摸设备的id是9,将其与HDMI-1绑定。
1 Y# z" f6 G* g" n
- Z/ e! }4 i3 c. Q
forlinx@forlinx:~$ xinput map-to-output 6 eDP-1
+ W" ~+ I9 ~1 Q6 R2 v4 a2 f
forlinx@forlinx:~$ xinput map-to-output 9 HDMI-1
& f h1 @% v# m- t' y" `$ ^
这样就可以实现RK3399下双屏异触了。测试了一下,两个屏幕各自的触摸效果还不错。
( O. Z1 ?5 r* p: Z, p- C
6 c, ~( {1 e. T% |: L" X8 F5 x
▼效果如下:
) a& G5 c# ]& ~9 D
1.jpg
(14.98 KB, 下载次数: 3)
下载附件
保存到相册
2022-8-11 10:06 上传
0 {6 I0 l$ ~- _
0
4 U* E9 t! f/ |. \/ p3 D* I, w
/ M; `6 M, O6 c' P
; D9 o4 F; b0 P. {# ?
m2 H/ ^- [; ~9 s" _5 F
作者:
Terran
时间:
2022-8-11 10:44
感谢,这东西好啊
作者:
VIC56
时间:
2022-8-11 11:18
谢谢分享
谢谢分享
欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/)
Powered by Discuz! X3.2