DexOnLinux/DexOnChromeOS – How To (NO ROOT)

Samsung announced a new feature with the Samsung Galaxy Note 10, the ability to access Samsung Dex on a Windows or MacOS device. This in my opinion was a game changer as it could allow users to use the insane power of their Galaxy Note 10/Note 10+ devices on inexpensive hardware. Samsung released a client for MacOS and Windows but as usual left us ChromeOS/Linux users out in the cold. It turns out that there is indeed a way to use Samsung Dex on Linux and X64 Chromebooks like the Pixelbook (Affiliate Link), Pixelbook Go (Affiliate Link) or even Samsung’s own line of Chromebooks, It does need a bit of inexpensive hardware and WiFi to setup .

What Works/Does Not Work

Works

  • Keyboard/Mouse
  • Shared Clipboard
  • Drag and Drop installation of APK files

Does Not Work

  • Sound routing (Sound stays on your phone or bluetooth headphones, if you have a 3.5 mm headphone jack on your USB-C dock, you can use it)
  • Right Clicking (You can connect a mouse to your phone if this is a must)

 

The Hardware

In order to setup DexOnLinux, you will need some hardware.

  • A USB-C to HDMI Dock (Affiliate Link) – This will be used to charge your Phone, expose some USB ports and the HDMI Port
  • A HDMI “Dummy” Terminator (Affiliate Link)
  • A USB Cable (Affiliate Link) to connect your phone to your PC
  • A fast LAN/WiFi Connection (802.11 ac or better). Your phone and machine should be on the same network. Ethernet will also work if your USB-C Dock has a Ethernet Port
  • A USB Power Brick (the one that came with your phone is fine)
  • A x86_64 computer or Chromebook – You will need ~4 GB of space

The Software

The software setup does require a few steps which will be outlined below. These instructions assume you are using Ubuntu or Debian however if you using a different distribution, you will need to modify the steps a bit.

Android Studio/Android SDK

Download Android Studio for your device and save it to your home directory. You can download Android Studio from https://developer.android.com/studio#downloads . This is a large download and may take some time on a slower connection. After the download is complete, you will need to install Android Studio. On ChromeOS, this can be done by running “sudo dpkg -i path-to-deb”, On Linux desktops, follow the steps here.

Launch Android Studio and select “configure”

Select “SDK Manager”

Select “Android 9.0 (Pie)” and “Apply”. Make note of the “SDK Root” before selecting “Ok”. You will be presented with the licenses for the SDK

Additional Dependencies

Run the following commands at a terminal to install the additional dependencies.

sudo apt install -y ffmpeg libsdl2-2.0-0 adb
sudo apt install -y gcc git pkg-config meson ninja-build libavcodec-dev libavformat-dev libavutil-dev libsdl2-dev
sudo apt install -y openjdk-8-jdk

Scrcpy

We will be using a amazing open source tool called Scrcpy to control our phone, unfortunately the versions of this tool in the apt repo is outdated, we will need to build it from source. This is a simple process, just run the following commands. You may need to modify the line that says “export ANDROID_HOME=” to point to the “SDK Root” path I asked you to note when installing the Android SDK

mkdir -p ~/tmp
cd ~/tmp
git clone https://github.com/Genymobile/scrcpy
cd scrcpy
export ANDROID_HOME=~/Android/Sdk/
meson x --buildtype release --strip -Db_lto=true
ninja -Cx
sudo ninja -Cx install

Developer Mode/ADB Debugging/Wireless ADB

You will now need to enable USB Debugging on your phone.

  1. Open the Android Settings
  2. Select “About Phone”
  3. Select “Software Version”
  4. Tap 7 times on “Build Number” and agree to enabling developer mode settings
  5. Re-Launch the Android Settings and select “Developer Options”
  6. Toggle “USB Debigging”
  7. Connect your directly to your computer and run “adb shell”, You should see a permissions prompt appear on your phone. If you are using a ChromeOS device, you will need to accept the prompt to pass the phone over to Linux before running the ADB command
  8. You should see a prompt similar to “d2q:/ $”
  9. Type exit to return back to a bash shell
  10. Run the command “adb tcpip 5555”
  11. Unplug your phone
  12. Find the LAN IP Address of your phone
  13. On your computer, run “adb connect IPADDRESS:5555” and hit enter

Note, you will need to re-do steps 9-12 each time you wish to use Dex on Linux

Start Screen Mirroring

  1. Connect the Dummy HDMI Dummy Terminator to the HDMI port on the USB-C dock
  2. Connect your phone to the USB-C Dock
  3. Connect your USB-C Dock to a power source

Run the following command on your computer to activate Dex

/usr/local/bin/scrcpy --display 2 --bit-rate 32M --window-title 'DexOnLinux' --turn-screen-off --stay-awake

Also published on Medium.

60 thoughts on “DexOnLinux/DexOnChromeOS – How To (NO ROOT)”

  1. Glad to see someone working on this. Hope the dummy hardware requirements can be removed in future. If it worked like the Windows 10 version, with just a software installation and a cable, I’m sure every Linux user with a Samsung Dex phone would use it.

    Reply
    • Type exit once and run it on the terminal. I just notice I may have made a small mistake in the instructions, I will update it right now. If you need help with it once it is updated, feel free to start a thread at @ https://chromebook.community/ and I will jump in.

      Reply
        • That did the trick! This works very well, you’re a wizard sir!

          So these are the steps that would be required to get it working again on the same machine?
          -Run the command “adb tcpip 5555”
          -Unplug your phone
          -Find the LAN IP Address of your phone
          -On your computer, run “adb connect IPADDRESS:5555” and hit enter
          -Run in terminal: /usr/local/bin/scrcpy –display 2 –bit-rate 32M –window-title ‘DexOnLinux’ –turn-screen-off –stay-awake

          Reply
  2. If you get an error that meson needs to be >=0.48. YOu need to update meson as well. Try this before installing scrcpy:

    sudo apt install python3-pip
    pip3 install meson

    Reply
  3. Hi. When I run [sudo apt install -y openjdk-8-jdk] I get [E: Unable to locate package openjdk-8-jdk]. I did all previous steps with no issues. Is there something I’m missing?

    Reply
      • That got me further! Thank you so much! But now when I run
        [cd ~/tmp]
        I get
        [-bash: cd: /home/{myUsername}/tmp: No such file or directory]

        Reply
          • Why is it necessary to find the LAN IP of the phone? also I’m getting an error on [adb connect IPADDRESS:5555]

          • At the moment, there is no easy way to connect the Dummy HDMI terminator and connect to the phone via USB ADB. Wireless ADB is currently the only option to get this to work.

            Make sure you start the wireless adb on the phone before truing the “adb connect IPADDRESS:5555” by running “adb tcpip 5555” while connected to USB,

          • okay I’m so close! I have the wireless adb up! now when I run the final command I get [-bash: /usr/local/bin/scrcpy: No such file or directory]. I appreciate all your help.

          • I don’t get an output when I enter “which scrcpy”. it just says “me@penguin:~/tmp/scrcpy$” awaiting input

          • Try the following
            cd ~/tmp/scrcpy
            export ANDROID_HOME=~/Android/Sdk/
            meson x –buildtype release –strip -Db_lto=true
            ninja -Cx
            sudo ninja -Cx install

            Can you paste the output of the build?

  4. me@penguin:~/tmp/scrcpy$ sudo ninja -Cx install
    ninja: Entering directory `x’
    [0/2] Generating scrcpy-server with a custom command.
    (not invoking gradle, since we are root)
    [1/2] Installing files.
    Installing app/scrcpy to /usr/local/bin
    Stripping target ‘app/scrcpy’
    Installing server/scrcpy-server to /usr/local/share/scrcpy
    Installing /home/me/tmp/scrcpy/app/scrcpy.1 to /usr/local/share/man/man1

    Reply
          • me@penguin:/usr/local/share/scrcpy$ /usr/local/bin/scrcpy
            INFO: scrcpy 1.16
            adb: error: failed to get feature set: no devices/emulators found
            ERROR: “adb push” returned with value 1

          • Ok, Thats good.

            Connect your phone to usb, and run

            adb tcpip 5555

            Unplug your phone, connect it to the Dummy HDMI terminator

            run
            adb connect IPADDRESS:5555
            /usr/local/bin/scrcpy –display 2 –bit-rate 32M –window-title ‘DexOnLinux’ –turn-screen-off –stay-awake

          • me@penguin:/usr/local/share/scrcpy$ adb tcpip 5555
            error: no devices/emulators found
            me@penguin:/usr/local/share/scrcpy$ adb devices
            List of devices attached

            Aww man its not finding my phone now! it was finding it before.

      • The dummy HDMI display is connected to the USB-C dock.
        When I change to display 0, I get a window with my phone.
        When I go with your last command (display 2) I get :
        eric@eric-Precision-5520:~$ adb connect 192.168.1.30:5555
        eric@eric-Precision-5520:~$ /usr/local/bin/scrcpy –display 2 –bit-rate 32M –window-title ‘DexOnLinux’ –turn-screen-off –stay-awake
        INFO: scrcpy 1.16
        /usr/local/share/scrcpy/scrcpy-server:…hed. 0.0 MB/s (33622 bytes in 10.913s)
        [server] INFO: Device: samsung SM-G975F (Android 10)
        [server] WARN: Display doesn’t have FLAG_SUPPORTS_PROTECTED_BUFFERS flag, mirroring can be restricted
        INFO: Renderer: opengl
        INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 20.0.8
        INFO: Trilinear filtering enabled
        INFO: Initial texture: 1920×1080
        [server] INFO: Device screen turned off

        When I turn on Dex on my phone in android settings, It looks for a wireless connection.
        Only Miracast is given as option, which is on my TV.

        Thank you for helping me out.

        Reply
  5. Hi Keith!

    First, congratulations on the excellent work!

    I was able to access dex on my distro. But the interface is very lagged. It depends on the wifi, right? I’m using ethernet, the wifi signal is very poor here.

    What can i do to work around this problem?

    Reply
  6. Hi,

    First of all, thank you so much for the guide!! It’s been amazing, I was really hoping for this functionality, and am glad to have it.
    I do have a couple questions/comments:

    -In ubuntu 20.0.4 , I managed to install both the studio, and scrcpy via snap install. Works fine, no extra tuning needed.

    -I don’t understand what the android studio is for. I installed everything. Configured it all. It worked.
    I uninstalled android studio. Restarted phone. Connected to USB and did the adb tcp 5555. then removed the cable and did the adb connect, then plugged into dock, ran connection string, works just fine. Was the studio only needed for the initial setup, if at all?

    One big question however:

    When following this method, I get an unfortunate side effect:
    Every time I click on a text box in dex, the on screen keyboard pops up.

    There is a setting in
    Dex settings>keyboard>show on-screen keyboard in Samsung Dex.
    But disabling it doesn’t seem to work with this method, it doesn’t appear to detect the keyboard, for the purpose of this option (though I can type fine etc).

    To get this to go away, do I need some sort of dummy keyboard terminator, akin to the hdmi terminator? Or is there a software option to yeet the on screen keyboard?

    Reply
  7. Keith – MUCH thanks for figuring this out. All works for me with Kubuntu 20.04 and a Samsung s10e. Except (there had to be an except), when I run scrcpy with –display 2 all I get is a window with black contents. Nothing there to see or click on. If I use –display 0, I get my Samsung screen scaled appropriately. And, frankly, that is all that I really wanted – to be able to enter data in a food diary application that has no desktop app — entering that kind of thing with a cell-phone keypad is awful. So, I got what I wanted. But also wanted you to know about the –display 2 versus –display 0 difference.

    Reply
  8. Just an update. In my elementary os (ubuntu 18.04 based distro), I had to install the `libavdevice-dev` apt package too.

    Reply
  9. Will this process work on 32-bit systems? If so, does anyone know which version of Android Studio was the last version to support 32-bit linux? I’m running Linux Mint 19.3 and cannot upgrade past that version since my machine is 32-bit, and LM 19.3 was the last version to support 32-bit systems. Thanks in advance for any help on this front. 🙂

    Reply
  10. I’m running Arch Linux. If you run a distro that provides “android-tools” as in “adb” and “fastboot” and a decently up to date copy of “scrcpy” then you can completely skip setting up Android Studio.

    Android Studio SDK is only required to compile “scrcpy” if the version in your distro is out of date or does not contain that package in the repositories.

    Reply
  11. For those who having error :
    Unsupported class file major version 63

    Update gradle version
    /tmp/scrcpy/gradle/wrapper/gradle-wrapper.properties

    Line
    distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip

    Reply

Leave a Reply to Mani Cancel reply

%d bloggers like this: