RK3399開發板Ubuntu系統下實現雙屏顯示&異觸

ningmengzier發表於2022-03-30

本文以飛凌嵌入式 為基礎講解,主要介紹了Ubuntu系統下雙屏顯示及異觸,其它 平臺請參考使用!

xrandr命令

“xrandr”是一款官方的 RandR擴充套件配置工具,它可以設定螢幕顯示的大小、方向、映象等。對於多螢幕顯示的情況,可以使用xrandr進行管理。

參考連結: (%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)

 

forlinx@forlinx:~$ xrandr --help
usage: xrandr [options]
  where options are:
  --display <display> or -d <display>
  --help
  -o <normal,inverted,left,right,0,1,2,3>
            or --orientation <normal,inverted,left,right,0,1,2,3>
  -q        or --query
  -s <size>/<width>x<height> or --size <size>/<width>x<height>
  -r <rate> or --rate <rate> or --refresh <rate>
  -v        or --version
  -x        (reflect in x)
  -y        (reflect in y)
  --screen <screen>
  --verbose
  --current
  --dryrun
  --nograb
  --prop or --properties
  --fb <width>x<height>
  --fbmm <width>x<height>
  --dpi <dpi>/<output>
  --output <output>
      --auto
      --mode <mode>
      --preferred
      --pos <x>x<y>
      --rate <rate> or --refresh <rate>
      --reflect normal,x,y,xy
      --rotate normal,inverted,left,right
      --left-of <output>
      --right-of <output>
      --above <output>
      --below <output>
      --same-as <output>
      --set <property> <value>
      --scale <x>x<y>
      --scale-from <w>x<h>
      --transform <a>,<b>,<c>,<d>,<e>,<f>,<g>,<h>,<i>
      --off
      --crtc <crtc>
      --panning <w>x<h>[+<x>+<y>[/<track:w>x<h>+<x>+<y>[/<border:l>/<t>/<r>/<b>]]]
      --gamma <r>:<g>:<b>
      --brightness <value>
      --primary
  --noprimary
  --newmode <name> <clock MHz>
            <hdisp> <hsync-start> <hsync-end> <htotal>
            <vdisp> <vsync-start> <vsync-end> <vtotal>
            [flags...]
            Valid flags: +HSync -HSync +VSync -VSync
                         +CSync -CSync CSync Interlace DoubleScan
  --rmmode <name>
  --addmode <output> <name>
  --delmode <output> <name>
  --listproviders
  --setprovideroutputsource <prov-xid> <source-xid>
  --setprovideroffloadsink <prov-xid> <sink-xid>
  --listmonitors
  --listactivemonitors
  --setmonitor <name> {auto|<w>/<mmw>x<h>/<mmh>+<x>+<y>} {none|<output>,<output>,...}
  --delmonitor <name>

雙屏擴充套件顯示

-C Ubuntu系統支援xrandr命令管理多屏擴充套件顯示。同時接入eDP螢幕和HDMI螢幕,系統會預設非熱插拔顯示裝置作為主屏,所以eDP會被識別為primary screen。預設會設定兩個螢幕為擴充套件顯示。

forlinx@forlinx:~$ xrandr
Screen 0: minimum 320 x 200, current 2560 x 1440, maximum 8192 x 8192
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 276mm x 156mm
   1920x1080     60.00*+
HDMI-1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
   2560x1440     59.95* 
   1920x1080     60.00    50.00    59.94  
   1680x1050     59.88  
   1280x1024     75.02    60.02  
   1440x900      59.90  
   1280x960      60.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    72.81    66.67    60.00    59.94  
   720x400       70.08

可以使用xrandr在兩個螢幕中選擇哪個做主屏,哪個做副屏。

xrandr --output eDP-1 --right-of HDMI-1 --auto

也可以將兩個螢幕設定成同顯

xrandr --output HDMI-1 --same-as eDP-1 --auto

xinput命令

xinput命令用於管理系統的輸入裝置。

forlinx@forlinx:~$ xinput --help
usage :
        xinput get-feedbacks <device name>
        xinput set-ptr-feedback <device name> <threshold> <num> <denom>
        xinput set-integer-feedback <device name> <feedback id> <value>
        xinput get-button-map <device name>
        xinput set-button-map <device name> <map button 1> [<map button 2> [...]]
        xinput set-pointer <device name> [<x index> <y index>]
        xinput set-mode <device name> ABSOLUTE|RELATIVE
        xinput list [--short || --long || --name-only || --id-only] [<device name>...]
        xinput query-state <device name>
        xinput test [-proximity] <device name>
        xinput create-master <id> [<sendCore (dflt:1)>] [<enable (dflt:1)>]
        xinput remove-master <id> [Floating|AttachToMaster (dflt:Floating)] [<returnPointer>] [<returnKeyboard>]
        xinput reattach <id> <master>
        xinput float <id>
        xinput set-cp <window> <device>
        xinput test-xi2 [--root] <device>
        xinput map-to-output <device> <output name>
        xinput list-props <device> [<device> ...]
        xinput set-int-prop <device> <property> <format (8, 16, 32)> <val> [<val> ...]
        xinput set-float-prop <device> <property> <val> [<val> ...]
        xinput set-atom-prop <device> <property> <val> [<val> ...]
        xinput watch-props <device>
        xinput delete-prop <device> <property>
        xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
        xinput disable <device>
        xinput enable <device>

分別插入了“wch.cn USB2IIC  CTPCONTROL”和“ILITEK ILITEK-TP”兩個USB電容觸控式螢幕。

forlinx@forlinx:~$ xinput
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ wch.cn USB2IIC_CTP_CONTROL                id=9    [slave  pointer  (2)]
⎜   ↳ ILITEK ILITEK-TP                          id=6    [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ rk_headset                                id=7    [slave  keyboard (3)]
    ↳ rk29-keypad                               id=8    [slave  keyboard (3)]
    ↳ InputEmulator                             id=10   [slave  keyboard (3)]

雙屏異觸

使用xinput對觸控裝置和顯示裝置進行繫結。ILITEK ILITEK-TP觸控裝置的id是6,將其與eDP-1繫結。wch.cn USB2IIC  CTPCONTROL觸控裝置的id是9,將其與HDMI-1繫結。

forlinx@forlinx:~$ xinput map-to-output 6 eDP-1
forlinx@forlinx:~$ xinput map-to-output 9 HDMI-1

這樣就可以實現RK3399下雙屏異觸了。測試了一下,兩個螢幕各自的觸控效果還不錯。

▼效果如下:

RK3399開發板Ubuntu系統下實現雙屏顯示&異觸

 

 

以上就是小編給大家分享的內容,希望能夠幫到您。


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69989353/viewspace-2884941/,如需轉載,請註明出處,否則將追究法律責任。

相關文章