Merge branch 'master' into dev

This commit is contained in:
Romain Vimont 2022-04-28 20:46:19 +02:00
commit 0049893e10
6 changed files with 371 additions and 141 deletions

View file

@ -46,7 +46,7 @@ sudo ninja -Cbuild-auto uninstall
### `master` ### `master`
The `master` branch concerns the latest release, and is the home page of the The `master` branch concerns the latest release, and is the home page of the
project on Github. project on GitHub.
### `dev` ### `dev`

View file

@ -375,7 +375,7 @@ Dies finden automatisch das Gerät und aktiviert den TCP/IP-Modus. Anschließend
Alternativ kann die TCP/IP-Verbindung auch manuell per `adb` aktiviert werden: Alternativ kann die TCP/IP-Verbindung auch manuell per `adb` aktiviert werden:
1. Gerät mit demselben Wifi wie den Computer verbinden. 1. Gerät mit demselben Wi-Fi wie den Computer verbinden.
2. IP-Adresse des Gerätes herausfinden, entweder über Einstellungen → Über das Telefon → Status, oder indem dieser Befehl ausgeführt wird: 2. IP-Adresse des Gerätes herausfinden, entweder über Einstellungen → Über das Telefon → Status, oder indem dieser Befehl ausgeführt wird:
```bash ```bash

View file

@ -218,7 +218,7 @@ variation] does not impact the recorded file.
#### Wireless #### Wireless
_Scrcpy_ menggunakan `adb` untuk berkomunikasi dengan perangkat, dan` adb` dapat [terhubung] ke perangkat melalui TCP / IP: _Scrcpy_ menggunakan `adb` untuk berkomunikasi dengan perangkat, dan `adb` dapat [terhubung] ke perangkat melalui TCP / IP:
1. Hubungkan perangkat ke Wi-Fi yang sama dengan komputer Anda. 1. Hubungkan perangkat ke Wi-Fi yang sama dengan komputer Anda.
2. Dapatkan alamat IP perangkat Anda (dalam Pengaturan → Tentang ponsel → Status). 2. Dapatkan alamat IP perangkat Anda (dalam Pengaturan → Tentang ponsel → Status).
@ -281,7 +281,7 @@ Dari terminal lain:
scrcpy scrcpy
``` ```
Untuk menghindari mengaktifkan penerusan port jarak jauh, Anda dapat memaksa sambungan maju sebagai gantinya (perhatikan `-L`, bukan` -R`): Untuk menghindari mengaktifkan penerusan port jarak jauh, Anda dapat memaksa sambungan maju sebagai gantinya (perhatikan `-L`, bukan `-R`):
```bash ```bash
adb kill-server # matikan server adb lokal di 5037 adb kill-server # matikan server adb lokal di 5037
@ -579,7 +579,7 @@ Lihat juga [Masalah #14].
Dalam daftar berikut, <kbd>MOD</kbd> adalah pengubah pintasan. Secara default, ini (kiri) <kbd>Alt</kbd> atau (kiri) <kbd>Super</kbd>. Dalam daftar berikut, <kbd>MOD</kbd> adalah pengubah pintasan. Secara default, ini (kiri) <kbd>Alt</kbd> atau (kiri) <kbd>Super</kbd>.
Ini dapat diubah menggunakan `--shortcut-mod`. Kunci yang memungkinkan adalah `lctrl`,`rctrl`, `lalt`,` ralt`, `lsuper` dan` rsuper`. Sebagai contoh: Ini dapat diubah menggunakan `--shortcut-mod`. Kunci yang memungkinkan adalah `lctrl`, `rctrl`, `lalt`, `ralt`, `lsuper` dan `rsuper`. Sebagai contoh:
```bash ```bash
# gunakan RCtrl untuk jalan pintas # gunakan RCtrl untuk jalan pintas

View file

@ -1,23 +1,42 @@
_Apri il [README](README.md) originale e sempre aggiornato._ _Apri il [README](README.md) originale (in inglese) e sempre aggiornato._
# scrcpy (v1.19) <img src="app/data/icon.svg" width="128" height="128" alt="scrcpy" align="right" />
Questa applicazione fornisce la visualizzazione e il controllo dei dispositivi Android collegati via USB (o [via TCP/IP][article-tcpip]). Non richiede alcun accesso _root_. # scrcpy (v1.23)
_si pronuncia "**scr**een **c**o**py**"_
[Leggi in altre lingue](#traduzioni)
Questa applicazione fornisce la visualizzazione e il controllo di dispositivi Android collegati via USB (o [via TCP/IP](#tcpip-wireless)). Non richiede alcun accesso _root_.
Funziona su _GNU/Linux_, _Windows_ e _macOS_. Funziona su _GNU/Linux_, _Windows_ e _macOS_.
![screenshot](assets/screenshot-debian-600.jpg) ![screenshot](assets/screenshot-debian-600.jpg)
Si concentra su: Si concentra su:
- **leggerezza** (nativo, mostra solo lo schermo del dispositivo) - **leggerezza**: nativo, mostra solo lo schermo del dispositivo
- **prestazioni** (30~60fps) - **prestazioni**: 30~120fps, in funzione del dispositivo
- **qualità** (1920×1080 o superiore) - **qualità**: 1920×1080 o superiore
- **bassa latenza** ([35~70ms][lowlatency]) - **bassa latenza**: [35~70ms][lowlatency]
- **tempo di avvio basso** (~ 1secondo per visualizzare la prima immagine) - **tempo di avvio basso**: ~ 1secondo per visualizzare la prima immagine
- **non invadenza** (nulla viene lasciato installato sul dispositivo) - **non invadenza**: nulla rimane installato sul dispositivo
- **vantaggi per l'utente**: nessun account, nessuna pubblicità, non è richiesta alcuna connessione a internet
- **libertà**: software libero e a codice aperto (_free and open source_)
[lowlatency]: https://github.com/Genymobile/scrcpy/pull/646 [lowlatency]: https://github.com/Genymobile/scrcpy/pull/646
Le sue caratteristiche includono:
- [registrazione](#registrazione)
- mirroring con [schermo del dispositivo spento](#spegnere-lo-schermo)
- [copia-incolla](#copia-incolla) in entrambe le direzioni
- [qualità configurabile](#configurazione-di-acquisizione)
- schermo del dispositivo [come webcam (V4L2)](#v4l2loopback) (solo per Linux)
- [simulazione della tastiera fisica (HID)](#simulazione-della-tastiera-fisica-HID)
- [simulazione mouse fisico (HID)](#simulazione-del-mouse-fisico-HID)
- [modalità OTG](#otg)
- e altro ancora...
## Requisiti ## Requisiti
@ -49,12 +68,18 @@ Compila dai sorgenti: [BUILD] (in inglese) ([procedimento semplificato][BUILD_si
### Linux ### Linux
Su Debian (_testing_ e _sid_ per ora) e Ubuntu (20.04): Su Debian e Ubuntu:
``` ```
apt install scrcpy apt install scrcpy
``` ```
Su Arch Linux:
```
pacman -S scrcpy
```
È disponibile anche un pacchetto [Snap]: [`scrcpy`][snap-link]. È disponibile anche un pacchetto [Snap]: [`scrcpy`][snap-link].
[snap-link]: https://snapstats.org/snaps/scrcpy [snap-link]: https://snapstats.org/snaps/scrcpy
@ -66,10 +91,6 @@ Per Fedora, è disponibile un pacchetto [COPR]: [`scrcpy`][copr-link].
[COPR]: https://fedoraproject.org/wiki/Category:Copr [COPR]: https://fedoraproject.org/wiki/Category:Copr
[copr-link]: https://copr.fedorainfracloud.org/coprs/zeno/scrcpy/ [copr-link]: https://copr.fedorainfracloud.org/coprs/zeno/scrcpy/
Per Arch Linux, è disponibile un pacchetto [AUR]: [`scrcpy`][aur-link].
[AUR]: https://wiki.archlinux.org/index.php/Arch_User_Repository
[aur-link]: https://aur.archlinux.org/packages/scrcpy/
Per Gentoo, è disponibile una [Ebuild]: [`scrcpy/`][ebuild-link]. Per Gentoo, è disponibile una [Ebuild]: [`scrcpy/`][ebuild-link].
@ -142,7 +163,7 @@ Collega un dispositivo Android ed esegui:
scrcpy scrcpy
``` ```
Scrcpy accetta argomenti da riga di comando, essi sono listati con: Scrcpy accetta argomenti da riga di comando, elencati con:
```bash ```bash
scrcpy --help scrcpy --help
@ -186,6 +207,14 @@ scrcpy --max-fps 15
Questo è supportato ufficialmente a partire da Android 10, ma potrebbe funzionare in versioni precedenti. Questo è supportato ufficialmente a partire da Android 10, ma potrebbe funzionare in versioni precedenti.
L'attuale frame rate di acquisizione può essere stampato sulla console:
```
scrcpy --print-fps
```
Può anche essere abilitato o disabilitato in qualsiasi momento con <kbd>MOD</kbd>+<kbd>i</kbd>.
#### Ritaglio #### Ritaglio
Lo schermo del dispositivo può essere ritagliato per visualizzare solo parte di esso. Lo schermo del dispositivo può essere ritagliato per visualizzare solo parte di esso.
@ -258,7 +287,7 @@ I "fotogrammi saltati" sono registrati nonostante non siano mostrati in tempo re
#### v4l2loopback #### v4l2loopback
Su Linux è possibile inviare il flusso video ad un dispositivo v4l2 loopback, cosicchè un dispositivo Android possa essere aperto come una webcam da qualsiasi strumento compatibile con v4l2. Su Linux è possibile inviare il flusso video ad un dispositivo v4l2 loopback, cosicché un dispositivo Android possa essere aperto come una webcam da qualsiasi strumento compatibile con v4l2.
Il modulo `v4l2loopback` deve essere installato: Il modulo `v4l2loopback` deve essere installato:
@ -321,42 +350,72 @@ scrcpy --display-buffer=50 # aggiungi 50 ms di buffer per la visualizzazione
e per il V4L2 sink: e per il V4L2 sink:
```bash ```bash
scrcpy --v4l2-buffer=500 # aggiungi 50 ms di buffer per il v4l2 sink scrcpy --v4l2-buffer=500 # aggiungi 500 ms di buffer per il v4l2 sink
``` ```
### Connessione ### Connessione
#### Wireless #### TCP/IP (wireless)
_Scrcpy_ usa `adb` per comunicare col dispositivo e `adb` può [connettersi][connect] a un dispositivo mediante TCP/IP. Il dispositivo deve essere collegato alla stessa rete del computer.
_Scrcpy_ usa `adb` per comunicare col dispositivo e `adb` può [connettersi][connect] al dispositivo mediante TCP/IP: ##### Automatico
1. Connetti il dispositivo alla stessa rete Wi-Fi del tuo computer. Un'opzione `--tcpip` permette di configurare automaticamente la connessione. Ci sono due varianti.
2. Trova l'indirizzo IP del tuo dispositivo in Impostazioni → Informazioni sul telefono → Stato, oppure eseguendo questo comando:
Se il dispositivo (accessibile a 192.168.1.1 in questo esempio) ascolta già su una porta (tipicamente 5555) per le connessioni adb in entrata, allora esegui:
```bash
scrcpy --tcpip=192.168.1.1 # la porta predefinita è 5555
scrcpy --tcpip=192.168.1.1:5555
```
Se la modalità TCP/IP di adb è disabilitata sul dispositivo (o se non si conosce l'indirizzo IP indirizzo), collegare il dispositivo tramite USB, quindi eseguire:
```bash
scrcpy --tcpip # senza argomenti
```
Il comando troverà automaticamente l'indirizzo IP del dispositivo, abiliterà la modalità TCP/IP, quindi connettersi al dispositivo prima di iniziare.
##### Manuale
In alternativa, è possibile abilitare la connessione TCP/IP manualmente usando `adb`:
1. Inserisci il dispositivo in una porta USB del tuo computer.
2. Connetti il dispositivo alla stessa rete Wi-Fi del tuo computer.
3. Ottieni l'indirizzo IP del tuo dispositivo, in Impostazioni → Informazioni sul telefono → Stato, o
eseguendo questo comando:
```bash ```bash
adb shell ip route | awk '{print $9}' adb shell ip route | awk '{print $9}'
``` ```
3. Abilita adb via TCP/IP sul tuo dispositivo: `adb tcpip 5555`. 4. Abilita adb via TCP/IP sul tuo dispositivo: `adb tcpip 5555`.
4. Scollega il tuo dispositivo. 5. Scollega il tuo dispositivo.
5. Connetti il tuo dispositivo: `adb connect IP_DISPOSITVO:5555` _(rimpiazza `IP_DISPOSITIVO`)_. 6. Connettiti al tuo dispositivo: `adb connect DEVICE_IP:5555` _(sostituisci `DEVICE_IP`
6. Esegui `scrcpy` come al solito. con l'indirizzo IP del dispositivo che hai trovato)_.
7. Esegui `scrcpy` come al solito.
Potrebbe essere utile diminuire il bit-rate e la definizione Da Android 11, una [opzione di debug wireless][adb-wireless] permette di evitare di dover collegare fisicamente il dispositivo direttamente al computer.
[adb-wireless]: https://developer.android.com/studio/command-line/adb#connect-to-a-device-over-wi-fi-android-11+
Se la connessione cade casualmente, esegui il comando `scrcpy` per riconnetterti. Se il comando dice che non ci sono dispositivi/emulatori trovati, prova ad eseguire `adb connect DEVICE_IP:5555` di nuovo, e poi `scrcpy` come al solito. Se dice ancora che non ne ha trovato nessuno, prova ad eseguire `adb disconnect` e poi esegui di nuovo questi due comandi.
Potrebbe essere utile diminuire il bit-rate e la definizione:
```bash ```bash
scrcpy --bit-rate 2M --max-size 800 scrcpy --bit-rate 2M --max-size 800
scrcpy -b2M -m800 # versione breve scrcpy -b2M -m800 # versione breve
``` ```
[connect]: https://developer.android.com/studio/command-line/adb.html#wireless [connect]: https://developer.android.com/studio/command-line/adb.html#wireless
#### Multi dispositivo #### Multi dispositivo
Se in `adb devices` sono listati più dispositivi, è necessario specificare il _seriale_: Se in `adb devices` sono elencati più dispositivi, è necessario specificare il _seriale_:
```bash ```bash
scrcpy --serial 0123456789abcdef scrcpy --serial 0123456789abcdef
@ -370,6 +429,18 @@ scrcpy --serial 192.168.0.1:5555
scrcpy -s 192.168.0.1:5555 # versione breve scrcpy -s 192.168.0.1:5555 # versione breve
``` ```
Se solo un dispositivo è collegato via USB o TCP/IP, è possibile selezionarlo automaticamente:
```bash
# Select the only device connected via USB
scrcpy -d # like adb -d
scrcpy --select-usb # long version
# Select the only device connected via TCP/IP
scrcpy -e # like adb -e
scrcpy --select-tcpip # long version
```
Puoi avviare più istanze di _scrcpy_ per diversi dispositivi. Puoi avviare più istanze di _scrcpy_ per diversi dispositivi.
@ -383,37 +454,77 @@ autoadb scrcpy -s '{}'
[AutoAdb]: https://github.com/rom1v/autoadb [AutoAdb]: https://github.com/rom1v/autoadb
#### Tunnel SSH #### Tunnels
Per connettersi a un dispositivo remoto è possibile collegare un client `adb` locale ad un server `adb` remoto (assunto che entrambi stiano usando la stessa versione del protocollo _adb_): Per connettersi a un dispositivo remoto, è possibile collegare un client `adb` locale a un server remoto `adb` (purché usino la stessa versione del protocollo _adb_). ).
##### Server ADB remoto
Per connettersi a un server ADB remoto, fate ascoltare il server su tutte le interfacce:
```bash ```bash
adb kill-server # termina il server adb locale su 5037 adb kill-server
ssh -CN -L5037:localhost:5037 -R27183:localhost:27183 your_remote_computer adb -a nodaemon server start
# tieni questo aperto # tienilo aperto
``` ```
Da un altro terminale: **Attenzione: tutte le comunicazioni tra i client e il server ADB non sono criptate.**
Supponi che questo server sia accessibile a 192.168.1.2. Poi, da un altro terminale, esegui scrcpy:
```bash ```bash
export ADB_SERVER_SOCKET=tcp:192.168.1.2:5037
scrcpy --tunnel-host=192.168.1.2
```
Per impostazione predefinita, scrcpy utilizza la porta locale utilizzata per il tunnel `adb forward` (tipicamente `27183`, vedi `--port`). È anche possibile forzare una diversa porta del tunnel (può essere utile in situazioni più complesse, quando sono coinvolti più reindirizzamenti):
```
scrcpy --tunnel-port=1234
```
##### SSH tunnel
Per comunicare con un server ADB remoto in modo sicuro, è preferibile utilizzare un tunnel SSH.
Per prima cosa, assicurati che il server ADB sia in esecuzione sul computer remoto:
```bash
adb start-server
```
Poi, crea un tunnel SSH:
```bash
# local 5038 --> remote 5037
# local 27183 <-- remote 27183
ssh -CN -L5038:localhost:5037 -R27183:localhost:27183 your_remote_computer
# keep this open
```
Da un altro terminale, esegui scrcpy:
```bash
export ADB_SERVER_SOCKET=tcp:localhost:5038
scrcpy scrcpy
``` ```
Per evitare l'abilitazione dell'apertura porte remota potresti invece forzare una "forward connection" (notare il `-L` invece di `-R`) Per evitare l'abilitazione dell'apertura porte remota potresti invece forzare una "forward connection" (notare il `-L` invece di `-R`)
```bash ```bash
adb kill-server # termina il server adb locale su 5037 # local 5038 --> remote 5037
ssh -CN -L5037:localhost:5037 -L27183:localhost:27183 your_remote_computer # local 27183 --> remote 27183
ssh -CN -L5038:localhost:5037 -L27183:localhost:27183 your_remote_computer
# tieni questo aperto # tieni questo aperto
``` ```
Da un altro terminale: Da un altro terminale, esegui scrcpy:
```bash ```bash
export ADB_SERVER_SOCKET=tcp:localhost:5038
scrcpy --force-adb-forward scrcpy --force-adb-forward
``` ```
Come per le connessioni wireless potrebbe essere utile ridurre la qualità: Come per le connessioni wireless potrebbe essere utile ridurre la qualità:
``` ```
@ -551,6 +662,14 @@ scrcpy --turn-screen-off --stay-awake
scrcpy -Sw scrcpy -Sw
``` ```
#### Spegnimento alla chiusura
Per spegnere lo schermo del dispositivo quando si chiude scrcpy:
```bash
scrcpy --power-off-on-close
```
#### Mostrare i tocchi #### Mostrare i tocchi
@ -596,20 +715,22 @@ Qualsiasi scorciatoia <kbd>Ctrl</kbd> viene inoltrata al dispositivo. In partico
- <kbd>Ctrl</kbd>+<kbd>x</kbd> taglia - <kbd>Ctrl</kbd>+<kbd>x</kbd> taglia
- <kbd>Ctrl</kbd>+<kbd>v</kbd> incolla (dopo la sincronizzazione degli appunti da computer a dispositivo) - <kbd>Ctrl</kbd>+<kbd>v</kbd> incolla (dopo la sincronizzazione degli appunti da computer a dispositivo)
Questo solitamente funziona nella maniera più comune. Questo solitamente funziona come ci si aspetta.
Il comportamento reale, però, dipende dall'applicazione attiva. Per esempio _Termux_ invia SIGINT con <kbd>Ctrl</kbd>+<kbd>c</kbd>, e _K-9 Mail_ compone un nuovo messaggio. Il comportamento reale, però, dipende dall'applicazione attiva. Per esempio _Termux_ invia SIGINT con <kbd>Ctrl</kbd>+<kbd>c</kbd>, e _K-9 Mail_ compone un nuovo messaggio.
Per copiare, tagliare e incollare in questi casi (ma è solo supportato in Android >= 7): Per copiare, tagliare e incollare in questi casi (ma è solo supportato in Android >= 7):
- <kbd>MOD</kbd>+<kbd>c</kbd> inietta `COPY` - <kbd>MOD</kbd>+<kbd>c</kbd> invia `COPY`
- <kbd>MOD</kbd>+<kbd>x</kbd> inietta `CUT` - <kbd>MOD</kbd>+<kbd>x</kbd> invia `CUT`
- <kbd>MOD</kbd>+<kbd>v</kbd> inietta `PASTE` (dopo la sincronizzazione degli appunti da computer a dispositivo) - <kbd>MOD</kbd>+<kbd>v</kbd> invia `PASTE` (dopo la sincronizzazione degli appunti da computer a dispositivo)
In aggiunta, <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd> permette l'iniezione del testo degli appunti del computer come una sequenza di eventi pressione dei tasti. Questo è utile quando il componente non accetta l'incollaggio di testo (per esempio in _Termux_), ma questo può rompere il contenuto non ASCII. In aggiunta, <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd> permette l'invio del testo degli appunti del computer come una sequenza di eventi pressione dei tasti. Questo è utile quando il componente non accetta l'incollaggio di testo (per esempio in _Termux_), ma questo può compromettere il contenuto non ASCII.
**AVVISO:** Incollare gli appunti del computer nel dispositivo (sia con <kbd>Ctrl</kbd>+<kbd>v</kbd> che con <kbd>MOD</kbd>+<kbd>v</kbd>) copia il contenuto negli appunti del dispositivo. Come conseguenza, qualsiasi applicazione Android potrebbe leggere il suo contenuto. Dovresti evitare di incollare contenuti sensibili (come password) in questa maniera. **AVVISO:** Incollare gli appunti del computer nel dispositivo (sia con <kbd>Ctrl</kbd>+<kbd>v</kbd> che con <kbd>MOD</kbd>+<kbd>v</kbd>) copia il contenuto negli appunti del dispositivo. Come conseguenza, qualsiasi applicazione Android potrebbe leggere il suo contenuto. Dovresti evitare di incollare contenuti sensibili (come password) in questa maniera.
Alcuni dispositivi non si comportano come aspettato quando si modificano gli appunti del dispositivo a livello di codice. L'opzione `--legacy-paste` è fornita per cambiare il comportamento di <kbd>Ctrl</kbd>+<kbd>v</kbd> and <kbd>MOD</kbd>+<kbd>v</kbd> in modo tale che anch'essi iniettino il testo gli appunti del computer come una sequenza di eventi pressione dei tasti (nella stessa maniera di <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>). Alcuni dispositivi non si comportano come aspettato quando si modificano gli appunti del dispositivo a livello di codice. L'opzione `--legacy-paste` è fornita per cambiare il comportamento di <kbd>Ctrl</kbd>+<kbd>v</kbd> and <kbd>MOD</kbd>+<kbd>v</kbd> in modo tale che anch'essi inviino il testo degli appunti del computer come una sequenza di eventi di pressione dei tasti (nella stessa maniera di <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>).
Per disabilitare la sincronizzazione automatica degli appunti, usa `--no-clipboard-autosync`.
#### Pizzica per zoomare (pinch-to-zoom) #### Pizzica per zoomare (pinch-to-zoom)
@ -617,16 +738,98 @@ Per simulare il "pizzica per zoomare": <kbd>Ctrl</kbd>+_click e trascina_.
Più precisamente, tieni premuto <kbd>Ctrl</kbd> mentre premi il pulsante sinistro. Finchè il pulsante non sarà rilasciato, tutti i movimenti del mouse ridimensioneranno e ruoteranno il contenuto (se supportato dall'applicazione) relativamente al centro dello schermo. Più precisamente, tieni premuto <kbd>Ctrl</kbd> mentre premi il pulsante sinistro. Finchè il pulsante non sarà rilasciato, tutti i movimenti del mouse ridimensioneranno e ruoteranno il contenuto (se supportato dall'applicazione) relativamente al centro dello schermo.
Concretamente scrcpy genera degli eventi di tocco addizionali di un "dito virtuale" nella posizione simmetricamente opposta rispetto al centro dello schermo. Concretamente, scrcpy genera degli eventi di tocco addizionali di un "dito virtuale" nella posizione simmetricamente opposta rispetto al centro dello schermo.
#### Simulazione della tastiera fisica (HID)
Per impostazione predefinita, scrcpy utilizza l'invio dei tasti o del testo di Android: funziona ovunque, ma è limitato all'ASCII.
In alternativa scrcpy può simulare una tastiera fisica USB su Android per fornire una migliore esperienza di input (utilizzando [USB HID over AOAv2][hid-aoav2]): la tastiera virtuale è disabilitata e funziona per tutti i caratteri e IME.
[hid-aoav2]: https://source.android.com/devices/accessories/aoa2#hid-support
Tuttavia, funziona solo se il dispositivo è collegato via USB.
Nota: su Windows, può funzionare solo in [odalità OTG](#otg), non durante il mirroring (non è possibile aprire un dispositivo USB se è già aperto da un altro processo come il daemon adb).
Per abilitare questa modalità:
```bash
scrcpy --hid-keyboard
scrcpy -K # versione breve
```
Se fallisce per qualche motivo (per esempio perché il dispositivo non è connesso via USB), ritorna automaticamente alla modalità predefinita (con un log nella console). Questo permette di usare le stesse opzioni della linea di comando quando si è connessi via USB e TCP/IP.
In questa modalità, gli eventi i pressione originali (scancodes) sono inviati al dispositivo, indipendentemente dalla mappatura dei tasti dell'host. Pertanto, se il layout della tua tastiera non corrisponde, deve essere configurato sul dispositivo Android, in Impostazioni → Sistema → Lingue e input → [Tastiera fisica] (in inglese).
Questa pagina di impostazioni può essere avviata direttamente:
```bash
adb shell am start -a android.settings.HARD_KEYBOARD_SETTINGS
```
Tuttavia, l'opzione è disponibile solo quando la tastiera HID è abilitata (o quando una tastiera fisica è collegata).
[Tastiera fisica]: https://github.com/Genymobile/scrcpy/pull/2632#issuecomment-923756915
#### Simulazione del mouse fisico (HID)
In modo simile alla simulazione della tastiera fisica, è possibile simulare un mouse fisico. Allo stesso modo funziona solo se il dispositivo è connesso via USB.
Per impostazione predefinita, scrcpy utilizza l'invio degli eventi del mouse di Android, utilizzando coordinate assolute. Simulando un mouse fisico, un puntatore del mouse appare sul dispositivo Android e vengono inviati i movimenti relativi del mouse, i click e gli scorrimenti.
Per abilitare questa modalità:
```bash
scrcpy --hid-mouse
scrcpy -M # versione breve
```
Si potrebbe anche aggiungere `--forward-all-clicks` a [inoltra tutti i pulsanti del mouse][forward_all_clicks].
[forward_all_clicks]: #click-destro-e-click-centrale
#### Preferenze di iniezione del testo Quando questa modalità è attivata, il mouse del computer viene "catturato" (il puntatore del mouse scompare dal computer e appare invece sul dispositivo Android).
I tasti speciali di cattura, <kbd>Alt</kbd> o <kbd>Super</kbd>, commutano (disabilitano o abilitano) la cattura del mouse. Usa uno di essi per ridare il controllo del mouse al computer.
#### OTG
È possibile eseguire _scrcpy_ con la sola simulazione della tastiera fisica e del mouse (HID), come se la tastiera e il mouse del computer fossero collegati direttamente al dispositivo tramite un cavo OTG.
In questa modalità, _adb_ (debug USB) non è necessario e il mirroring è disabilitato.
Per attivare la modallità OTG:
```bash
scrcpy --otg
# Passa la seriale se sono disponibili diversi dispositivi USB
scrcpy --otg -s 0123456789abcdef
```
È possibile abilitare solo la tastiera HID o il mouse HID:
```bash
scrcpy --otg --hid-keyboard # solo la tastiera
scrcpy --otg --hid-mouse # solo mouse
scrcpy --otg --hid-keyboard --hid-mouse # tastiera e mouse
# per comodità, abilita entrambi per default
scrcpy --otg # tastiera e mouse
```
Come `--hid-keyboard` e `--hid-mouse`, funziona solo se il dispositivo è collegato via USB.
#### Preferenze di invio del testo
Ci sono due tipi di [eventi][textevents] generati quando si scrive testo: Ci sono due tipi di [eventi][textevents] generati quando si scrive testo:
- _eventi di pressione_, segnalano che tasto è stato premuto o rilasciato; - _eventi di pressione_, segnalano che tasto è stato premuto o rilasciato;
- _eventi di testo_, segnalano che del testo è stato inserito. - _eventi di testo_, segnalano che del testo è stato inserito.
In maniera predefinita le lettere sono "iniettate" usando gli eventi di pressione, in maniera tale che la tastiera si comporti come aspettato nei giochi (come accade solitamente per i tasti WASD). In maniera predefinita le lettere sono inviate usando gli eventi di pressione, in maniera tale che la tastiera si comporti come aspettato nei giochi (come accade solitamente per i tasti WASD).
Questo, però, può [causare problemi][prefertext]. Se incontri un problema del genere, puoi evitarlo con: Questo, però, può [causare problemi][prefertext]. Se incontri un problema del genere, puoi evitarlo con:
@ -636,13 +839,21 @@ scrcpy --prefer-text
(ma questo romperà il normale funzionamento della tastiera nei giochi) (ma questo romperà il normale funzionamento della tastiera nei giochi)
Al contrario, si potrebbe forzare per inviare sempre eventi di pressione grezzi:
```bash
scrcpy --raw-key-events
```
Queste opzioni non hanno effetto sulla tastiera HID (tutti gli eventi di pressione sono inviati come scancodes in questa modalità).
[textevents]: https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-text-input [textevents]: https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-text-input
[prefertext]: https://github.com/Genymobile/scrcpy/issues/650#issuecomment-512945343 [prefertext]: https://github.com/Genymobile/scrcpy/issues/650#issuecomment-512945343
#### Ripetizione di tasti #### Ripetizione di tasti
In maniera predefinita tenere premuto un tasto genera una ripetizione degli eventi di pressione di tale tasto. Questo può creare problemi di performance in alcuni giochi, dove questi eventi sono inutilizzati. In maniera predefinita, tenere premuto un tasto genera una ripetizione degli eventi di pressione di tale tasto. Questo può creare problemi di performance in alcuni giochi, dove questi eventi sono inutilizzati.
Per prevenire l'inoltro ripetuto degli eventi di pressione: Per prevenire l'inoltro ripetuto degli eventi di pressione:
@ -650,9 +861,12 @@ Per prevenire l'inoltro ripetuto degli eventi di pressione:
scrcpy --no-key-repeat scrcpy --no-key-repeat
``` ```
Questa opzione non ha effetto sulla tastiera HID (la ripetizione dei tasti è gestita da Android direttamente in questa modalità).
#### Click destro e click centrale #### Click destro e click centrale
In maniera predefinita, click destro aziona BACK (indietro) e il click centrale aziona HOME. Per disabilitare queste scorciatoie e, invece, inviare i click al dispositivo: In maniera predefinita, click destro aziona BACK (indietro) o POWER on (accensione) e il click centrale aziona HOME. Per disabilitare queste scorciatoie e, invece, inviare i click al dispositivo:
```bash ```bash
scrcpy --forward-all-clicks scrcpy --forward-all-clicks
@ -705,7 +919,7 @@ scrcpy --shortcut-mod=rctrl
scrcpy --shortcut-mod=lctrl+lalt,lsuper scrcpy --shortcut-mod=lctrl+lalt,lsuper
``` ```
_<kbd>[Super]</kbd> è il pulsante <kbd>Windows</kbd> o <kbd>Cmd</kbd>._ _<kbd>[Super]</kbd> è solitamente il pulsante <kbd>Windows</kbd> o <kbd>Cmd</kbd>._
[Super]: https://it.wikipedia.org/wiki/Tasto_Windows [Super]: https://it.wikipedia.org/wiki/Tasto_Windows
<!-- https://en.wikipedia.org/wiki/Super_key_(keyboard_button) è la pagina originale di Wikipedia inglese, l'ho sostituita con una simile in quello italiano --> <!-- https://en.wikipedia.org/wiki/Super_key_(keyboard_button) è la pagina originale di Wikipedia inglese, l'ho sostituita con una simile in quello italiano -->
@ -720,7 +934,7 @@ _<kbd>[Super]</kbd> è il pulsante <kbd>Windows</kbd> o <kbd>Cmd</kbd>._
| Premi il tasto `HOME` | <kbd>MOD</kbd>+<kbd>h</kbd> \| _Click centrale_ | Premi il tasto `HOME` | <kbd>MOD</kbd>+<kbd>h</kbd> \| _Click centrale_
| Premi il tasto `BACK` | <kbd>MOD</kbd>+<kbd>b</kbd> \| _Click destro²_ | Premi il tasto `BACK` | <kbd>MOD</kbd>+<kbd>b</kbd> \| _Click destro²_
| Premi il tasto `APP_SWITCH` | <kbd>MOD</kbd>+<kbd>s</kbd> \| _4° click³_ | Premi il tasto `APP_SWITCH` | <kbd>MOD</kbd>+<kbd>s</kbd> \| _4° click³_
| Premi il tasto `MENU` (sblocca lo schermo) | <kbd>MOD</kbd>+<kbd>m</kbd> | Premi il tasto `MENU` (sblocca lo schermo) | <kbd>MOD</kbd>+<kbd>m</kbd>
| Premi il tasto `VOLUME_UP` | <kbd>MOD</kbd>+<kbd></kbd> _(su)_ | Premi il tasto `VOLUME_UP` | <kbd>MOD</kbd>+<kbd></kbd> _(su)_
| Premi il tasto `VOLUME_DOWN` | <kbd>MOD</kbd>+<kbd></kbd> _(giù)_ | Premi il tasto `VOLUME_DOWN` | <kbd>MOD</kbd>+<kbd></kbd> _(giù)_
| Premi il tasto `POWER` | <kbd>MOD</kbd>+<kbd>p</kbd> | Premi il tasto `POWER` | <kbd>MOD</kbd>+<kbd>p</kbd>
@ -731,17 +945,20 @@ _<kbd>[Super]</kbd> è il pulsante <kbd>Windows</kbd> o <kbd>Cmd</kbd>._
| Espandi il pannello delle notifiche | <kbd>MOD</kbd>+<kbd>n</kbd> \| _5° click³_ | Espandi il pannello delle notifiche | <kbd>MOD</kbd>+<kbd>n</kbd> \| _5° click³_
| Espandi il pannello delle impostazioni | <kbd>MOD</kbd>+<kbd>n</kbd>+<kbd>n</kbd> \| _Doppio 5° click³_ | Espandi il pannello delle impostazioni | <kbd>MOD</kbd>+<kbd>n</kbd>+<kbd>n</kbd> \| _Doppio 5° click³_
| Chiudi pannelli | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>n</kbd> | Chiudi pannelli | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>n</kbd>
| Copia negli appunti | <kbd>MOD</kbd>+<kbd>c</kbd> | Copia negli appunti | <kbd>MOD</kbd>+<kbd>c</kbd>
| Taglia negli appunti | <kbd>MOD</kbd>+<kbd>x</kbd> | Taglia negli appunti | <kbd>MOD</kbd>+<kbd>x</kbd>
| Sincronizza gli appunti e incolla | <kbd>MOD</kbd>+<kbd>v</kbd> | Sincronizza gli appunti e incolla | <kbd>MOD</kbd>+<kbd>v</kbd>
| Inietta il testo degli appunti del computer | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd> | Invia il testo degli appunti del computer | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>
| Abilita/Disabilita il contatore FPS (su stdout) | <kbd>MOD</kbd>+<kbd>i</kbd> | Abilita/Disabilita il contatore FPS (su stdout) | <kbd>MOD</kbd>+<kbd>i</kbd>
| Pizzica per zoomare | <kbd>Ctrl</kbd>+_click e trascina_ | Pizzica per zoomare | <kbd>Ctrl</kbd>+_click e trascina_
| Trascina file APK | Installa APK dal computer
| Trascina file non-APK | [Trasferisci file verso il dispositivo](#push-file-to-device)
_¹Doppio click sui bordi neri per rimuoverli._ _¹Doppio click sui bordi neri per rimuoverli._
_²Il tasto destro accende lo schermo se era spento, preme BACK in caso contrario._ _²Il tasto destro accende lo schermo se era spento, preme BACK in caso contrario._
_³4° e 5° pulsante del mouse, se il tuo mouse ne dispone._ _³4° e 5° pulsante del mouse, se il tuo mouse ne dispone._
_⁴Solo in Android >= 7._ _⁴Per le app native react in sviluppo, `MENU` attiva il menu di sviluppo._
_⁵Solo in Android >= 7._
Le scorciatoie con pulsanti ripetuti sono eseguite rilasciando e premendo il pulsante una seconda volta. Per esempio, per eseguire "Espandi il pannello delle impostazioni": Le scorciatoie con pulsanti ripetuti sono eseguite rilasciando e premendo il pulsante una seconda volta. Per esempio, per eseguire "Espandi il pannello delle impostazioni":
@ -811,3 +1028,14 @@ Leggi la [pagina per sviluppatori].
[article-intro]: https://blog.rom1v.com/2018/03/introducing-scrcpy/ [article-intro]: https://blog.rom1v.com/2018/03/introducing-scrcpy/
[article-tcpip]: https://www.genymotion.com/blog/open-source-project-scrcpy-now-works-wirelessly/ [article-tcpip]: https://www.genymotion.com/blog/open-source-project-scrcpy-now-works-wirelessly/
## Contatti
Se incontri un bug, per favore leggi prima le [FAQ](FAQ.it.md), poi apri una [issue].
[issue]: https://github.com/Genymobile/scrcpy/issues
Per domande generali o discussioni, puoi anche usare:
- Reddit: [`r/scrcpy`](https://www.reddit.com/r/scrcpy)
- Twitter: [`@scrcpy_app`](https://twitter.com/scrcpy_app)

154
README.md
View file

@ -7,7 +7,7 @@ _pronounced "**scr**een **c**o**py**"_
[Read in another language](#translations) [Read in another language](#translations)
This application provides display and control of Android devices connected via This application provides display and control of Android devices connected via
USB (or [over TCP/IP](#tcpip-wireless)). It does not require any _root_ access. USB or [over TCP/IP](#tcpip-wireless). It does not require any _root_ access.
It works on _GNU/Linux_, _Windows_ and _macOS_. It works on _GNU/Linux_, _Windows_ and _macOS_.
![screenshot](assets/screenshot-debian-600.jpg) ![screenshot](assets/screenshot-debian-600.jpg)
@ -19,7 +19,7 @@ It focuses on:
- **quality**: 1920×1080 or above - **quality**: 1920×1080 or above
- **low latency**: [35~70ms][lowlatency] - **low latency**: [35~70ms][lowlatency]
- **low startup time**: ~1 second to display the first image - **low startup time**: ~1 second to display the first image
- **non-intrusiveness**: nothing is left installed on the device - **non-intrusiveness**: nothing is left installed on the Android device
- **user benefits**: no account, no ads, no internet required - **user benefits**: no account, no ads, no internet required
- **freedom**: free and open source software - **freedom**: free and open source software
@ -27,10 +27,10 @@ It focuses on:
Its features include: Its features include:
- [recording](#recording) - [recording](#recording)
- mirroring with [device screen off](#turn-screen-off) - mirroring with [Android device screen off](#turn-screen-off)
- [copy-paste](#copy-paste) in both directions - [copy-paste](#copy-paste) in both directions
- [configurable quality](#capture-configuration) - [configurable quality](#capture-configuration)
- device screen [as a webcam (V4L2)](#v4l2loopback) (Linux-only) - Android device [as a webcam (V4L2)](#v4l2loopback) (Linux-only)
- [physical keyboard simulation (HID)](#physical-keyboard-simulation-hid) - [physical keyboard simulation (HID)](#physical-keyboard-simulation-hid)
- [physical mouse simulation (HID)](#physical-mouse-simulation-hid) - [physical mouse simulation (HID)](#physical-mouse-simulation-hid)
- [OTG mode](#otg) - [OTG mode](#otg)
@ -40,12 +40,12 @@ Its features include:
The Android device requires at least API 21 (Android 5.0). The Android device requires at least API 21 (Android 5.0).
Make sure you [enabled adb debugging][enable-adb] on your device(s). Make sure you [enable adb debugging][enable-adb] on your device(s).
[enable-adb]: https://developer.android.com/studio/command-line/adb.html#Enabling [enable-adb]: https://developer.android.com/studio/command-line/adb.html#Enabling
On some devices, you also need to enable [an additional option][control] to On some devices, you also need to enable [an additional option][control] to
control it using keyboard and mouse. control it using a keyboard and mouse.
[control]: https://github.com/Genymobile/scrcpy/issues/70#issuecomment-373286323 [control]: https://github.com/Genymobile/scrcpy/issues/70#issuecomment-373286323
@ -97,14 +97,14 @@ For Gentoo, an [Ebuild] is available: [`scrcpy/`][ebuild-link].
[Ebuild]: https://wiki.gentoo.org/wiki/Ebuild [Ebuild]: https://wiki.gentoo.org/wiki/Ebuild
[ebuild-link]: https://github.com/maggu2810/maggu2810-overlay/tree/master/app-mobilephone/scrcpy [ebuild-link]: https://github.com/maggu2810/maggu2810-overlay/tree/master/app-mobilephone/scrcpy
You could also [build the app manually][BUILD] ([simplified You can also [build the app manually][BUILD] ([simplified
process][BUILD_simple]). process][BUILD_simple]).
### Windows ### Windows
For Windows, for simplicity, a prebuilt archive with all the dependencies For Windows, a prebuilt archive with all the dependencies (including `adb`) is
(including `adb`) is available: available:
- [`scrcpy-win64-v1.23.zip`][direct-win64] - [`scrcpy-win64-v1.23.zip`][direct-win64]
_(SHA-256: d2f601b1d0157faf65153d8a093d827fd65aec5d5842d677ac86fb2b5b7704cc)_ _(SHA-256: d2f601b1d0157faf65153d8a093d827fd65aec5d5842d677ac86fb2b5b7704cc)_
@ -148,7 +148,7 @@ You need `adb`, accessible from your `PATH`. If you don't have it yet:
brew install android-platform-tools brew install android-platform-tools
``` ```
It's also available in [MacPorts], which sets up adb for you: It's also available in [MacPorts], which sets up `adb` for you:
```bash ```bash
sudo port install scrcpy sudo port install scrcpy
@ -162,7 +162,7 @@ You can also [build the app manually][BUILD].
## Run ## Run
Plug an Android device, and execute: Plug an Android device into your computer, and execute:
```bash ```bash
scrcpy scrcpy
@ -180,7 +180,7 @@ scrcpy --help
#### Reduce size #### Reduce size
Sometimes, it is useful to mirror an Android device at a lower definition to Sometimes, it is useful to mirror an Android device at a lower resolution to
increase performance. increase performance.
To limit both the width and height to some value (e.g. 1024): To limit both the width and height to some value (e.g. 1024):
@ -190,8 +190,8 @@ scrcpy --max-size 1024
scrcpy -m 1024 # short version scrcpy -m 1024 # short version
``` ```
The other dimension is computed to that the device aspect ratio is preserved. The other dimension is computed so that the Android device aspect ratio is
That way, a device in 1920×1080 will be mirrored at 1024×576. preserved. That way, a device in 1920×1080 will be mirrored at 1024×576.
#### Change bit-rate #### Change bit-rate
@ -226,7 +226,7 @@ It may also be enabled or disabled at any time with <kbd>MOD</kbd>+<kbd>i</kbd>.
The device screen may be cropped to mirror only part of the screen. The device screen may be cropped to mirror only part of the screen.
This is useful for example to mirror only one eye of the Oculus Go: This is useful, for example, to mirror only one eye of the Oculus Go:
```bash ```bash
scrcpy --crop 1224:1440:0:0 # 1224x1440 at offset (0,0) scrcpy --crop 1224:1440:0:0 # 1224x1440 at offset (0,0)
@ -237,7 +237,6 @@ If `--max-size` is also specified, resizing is applied after cropping.
#### Lock video orientation #### Lock video orientation
To lock the orientation of the mirroring: To lock the orientation of the mirroring:
```bash ```bash
@ -262,7 +261,7 @@ crash. It is possible to select a different encoder:
scrcpy --encoder OMX.qcom.video.encoder.avc scrcpy --encoder OMX.qcom.video.encoder.avc
``` ```
To list the available encoders, you could pass an invalid encoder name, the To list the available encoders, you can pass an invalid encoder name; the
error will give the available encoders: error will give the available encoders:
```bash ```bash
@ -326,7 +325,7 @@ v4l2-ctl --list-devices
ls /dev/video* ls /dev/video*
``` ```
To start scrcpy using a v4l2 sink: To start `scrcpy` using a v4l2 sink:
```bash ```bash
scrcpy --v4l2-sink=/dev/videoN scrcpy --v4l2-sink=/dev/videoN
@ -334,7 +333,7 @@ scrcpy --v4l2-sink=/dev/videoN --no-display # disable mirroring window
scrcpy --v4l2-sink=/dev/videoN -N # short version scrcpy --v4l2-sink=/dev/videoN -N # short version
``` ```
(replace `N` by the device ID, check with `ls /dev/video*`) (replace `N` with the device ID, check with `ls /dev/video*`)
Once enabled, you can open your video stream with a v4l2-capable tool: Once enabled, you can open your video stream with a v4l2-capable tool:
@ -350,7 +349,7 @@ For example, you could capture the video within [OBS].
#### Buffering #### Buffering
It is possible to add buffering. This increases latency but reduces jitter (see It is possible to add buffering. This increases latency, but reduces jitter (see
[#2464]). [#2464]).
[#2464]: https://github.com/Genymobile/scrcpy/issues/2464 [#2464]: https://github.com/Genymobile/scrcpy/issues/2464
@ -382,14 +381,14 @@ An option `--tcpip` allows to configure the connection automatically. There are
two variants. two variants.
If the device (accessible at 192.168.1.1 in this example) already listens on a If the device (accessible at 192.168.1.1 in this example) already listens on a
port (typically 5555) for incoming adb connections, then run: port (typically 5555) for incoming _adb_ connections, then run:
```bash ```bash
scrcpy --tcpip=192.168.1.1 # default port is 5555 scrcpy --tcpip=192.168.1.1 # default port is 5555
scrcpy --tcpip=192.168.1.1:5555 scrcpy --tcpip=192.168.1.1:5555
``` ```
If adb TCP/IP mode is disabled on the device (or if you don't know the IP If _adb_ TCP/IP mode is disabled on the device (or if you don't know the IP
address), connect the device over USB, then run: address), connect the device over USB, then run:
```bash ```bash
@ -413,7 +412,7 @@ Alternatively, it is possible to enable the TCP/IP connection manually using
adb shell ip route | awk '{print $9}' adb shell ip route | awk '{print $9}'
``` ```
4. Enable adb over TCP/IP on your device: `adb tcpip 5555`. 4. Enable `adb` over TCP/IP on your device: `adb tcpip 5555`.
5. Unplug your device. 5. Unplug your device.
6. Connect to your device: `adb connect DEVICE_IP:5555` _(replace `DEVICE_IP` 6. Connect to your device: `adb connect DEVICE_IP:5555` _(replace `DEVICE_IP`
with the device IP address you found)_. with the device IP address you found)_.
@ -427,9 +426,9 @@ having to physically connect your device directly to your computer.
If the connection randomly drops, run your `scrcpy` command to reconnect. If it If the connection randomly drops, run your `scrcpy` command to reconnect. If it
says there are no devices/emulators found, try running `adb connect says there are no devices/emulators found, try running `adb connect
DEVICE_IP:5555` again, and then `scrcpy` as usual. If it still says there are DEVICE_IP:5555` again, and then `scrcpy` as usual. If it still says there are
none found, try running `adb disconnect` and then run those two commands again. none found, try running `adb disconnect`, and then run those two commands again.
It may be useful to decrease the bit-rate and the definition: It may be useful to decrease the bit-rate and the resolution:
```bash ```bash
scrcpy --bit-rate 2M --max-size 800 scrcpy --bit-rate 2M --max-size 800
@ -491,7 +490,7 @@ protocol).
##### Remote ADB server ##### Remote ADB server
To connect to a remote ADB server, make the server listen on all interfaces: To connect to a remote _adb server_, make the server listen on all interfaces:
```bash ```bash
adb kill-server adb kill-server
@ -499,17 +498,18 @@ adb -a nodaemon server start
# keep this open # keep this open
``` ```
**Warning: all communications between clients and ADB server are unencrypted.** **Warning: all communications between clients and the _adb server_ are
unencrypted.**
Suppose that this server is accessible at 192.168.1.2. Then, from another Suppose that this server is accessible at 192.168.1.2. Then, from another
terminal, run scrcpy: terminal, run `scrcpy`:
```bash ```bash
export ADB_SERVER_SOCKET=tcp:192.168.1.2:5037 export ADB_SERVER_SOCKET=tcp:192.168.1.2:5037
scrcpy --tunnel-host=192.168.1.2 scrcpy --tunnel-host=192.168.1.2
``` ```
By default, scrcpy uses the local port used for `adb forward` tunnel By default, `scrcpy` uses the local port used for `adb forward` tunnel
establishment (typically `27183`, see `--port`). It is also possible to force a establishment (typically `27183`, see `--port`). It is also possible to force a
different tunnel port (it may be useful in more complex situations, when more different tunnel port (it may be useful in more complex situations, when more
redirections are involved): redirections are involved):
@ -521,16 +521,16 @@ scrcpy --tunnel-port=1234
##### SSH tunnel ##### SSH tunnel
To communicate with a remote ADB server securely, it is preferable to use a SSH To communicate with a remote _adb server_ securely, it is preferable to use an
tunnel. SSH tunnel.
First, make sure the ADB server is running on the remote computer: First, make sure the _adb server_ is running on the remote computer:
```bash ```bash
adb start-server adb start-server
``` ```
Then, establish a SSH tunnel: Then, establish an SSH tunnel:
```bash ```bash
# local 5038 --> remote 5037 # local 5038 --> remote 5037
@ -539,7 +539,7 @@ ssh -CN -L5038:localhost:5037 -R27183:localhost:27183 your_remote_computer
# keep this open # keep this open
``` ```
From another terminal, run scrcpy: From another terminal, run `scrcpy`:
```bash ```bash
export ADB_SERVER_SOCKET=tcp:localhost:5038 export ADB_SERVER_SOCKET=tcp:localhost:5038
@ -556,7 +556,7 @@ ssh -CN -L5038:localhost:5037 -L27183:localhost:27183 your_remote_computer
# keep this open # keep this open
``` ```
From another terminal, run scrcpy: From another terminal, run `scrcpy`:
```bash ```bash
export ADB_SERVER_SOCKET=tcp:localhost:5038 export ADB_SERVER_SOCKET=tcp:localhost:5038
@ -598,7 +598,7 @@ scrcpy --window-borderless
#### Always on top #### Always on top
To keep the scrcpy window always on top: To keep the _scrcpy_ window always on top:
```bash ```bash
scrcpy --always-on-top scrcpy --always-on-top
@ -623,7 +623,7 @@ The window may be rotated:
scrcpy --rotation 1 scrcpy --rotation 1
``` ```
Possibles values are: Possible values:
- `0`: no rotation - `0`: no rotation
- `1`: 90 degrees counterclockwise - `1`: 90 degrees counterclockwise
- `2`: 180 degrees - `2`: 180 degrees
@ -672,19 +672,19 @@ adb shell dumpsys display # search "mDisplayId=" in the output
``` ```
The secondary display may only be controlled if the device runs at least Android The secondary display may only be controlled if the device runs at least Android
10 (otherwise it is mirrored in read-only). 10 (otherwise it is mirrored as read-only).
#### Stay awake #### Stay awake
To prevent the device to sleep after some delay when the device is plugged in: To prevent the device from sleeping after a delay when the device is plugged in:
```bash ```bash
scrcpy --stay-awake scrcpy --stay-awake
scrcpy -w scrcpy -w
``` ```
The initial state is restored when scrcpy is closed. The initial state is restored when _scrcpy_ is closed.
#### Turn screen off #### Turn screen off
@ -702,9 +702,10 @@ Or by pressing <kbd>MOD</kbd>+<kbd>o</kbd> at any time.
To turn it back on, press <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>o</kbd>. To turn it back on, press <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>o</kbd>.
On Android, the `POWER` button always turns the screen on. For convenience, if On Android, the `POWER` button always turns the screen on. For convenience, if
`POWER` is sent via scrcpy (via right-click or <kbd>MOD</kbd>+<kbd>p</kbd>), it `POWER` is sent via _scrcpy_ (via right-click or <kbd>MOD</kbd>+<kbd>p</kbd>),
will force to turn the screen off after a small delay (on a best effort basis). it will force to turn the screen off after a small delay (on a best effort
The physical `POWER` button will still cause the screen to be turned on. basis). The physical `POWER` button will still cause the screen to be turned
on.
It can also be useful to prevent the device from sleeping: It can also be useful to prevent the device from sleeping:
@ -715,7 +716,7 @@ scrcpy -Sw
#### Power off on close #### Power off on close
To turn the device screen off when closing scrcpy: To turn the device screen off when closing _scrcpy_:
```bash ```bash
scrcpy --power-off-on-close scrcpy --power-off-on-close
@ -747,12 +748,13 @@ scrcpy --show-touches
scrcpy -t scrcpy -t
``` ```
Note that it only shows _physical_ touches (with the finger on the device). Note that it only shows _physical_ touches (by a finger on the device).
#### Disable screensaver #### Disable screensaver
By default, scrcpy does not prevent the screensaver to run on the computer. By default, _scrcpy_ does not prevent the screensaver from running on the
computer.
To disable it: To disable it:
@ -794,18 +796,18 @@ To copy, cut and paste in such cases (but only supported on Android >= 7):
- <kbd>MOD</kbd>+<kbd>v</kbd> injects `PASTE` (after computer-to-device - <kbd>MOD</kbd>+<kbd>v</kbd> injects `PASTE` (after computer-to-device
clipboard synchronization) clipboard synchronization)
In addition, <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd> allows to inject the In addition, <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd> injects the computer
computer clipboard text as a sequence of key events. This is useful when the clipboard text as a sequence of key events. This is useful when the component
component does not accept text pasting (for example in _Termux_), but it can does not accept text pasting (for example in _Termux_), but it can break
break non-ASCII content. non-ASCII content.
**WARNING:** Pasting the computer clipboard to the device (either via **WARNING:** Pasting the computer clipboard to the device (either via
<kbd>Ctrl</kbd>+<kbd>v</kbd> or <kbd>MOD</kbd>+<kbd>v</kbd>) copies the content <kbd>Ctrl</kbd>+<kbd>v</kbd> or <kbd>MOD</kbd>+<kbd>v</kbd>) copies the content
into the device clipboard. As a consequence, any Android application could read into the Android clipboard. As a consequence, any Android application could read
its content. You should avoid to paste sensitive content (like passwords) that its content. You should avoid pasting sensitive content (like passwords) that
way. way.
Some devices do not behave as expected when setting the device clipboard Some Android devices do not behave as expected when setting the device clipboard
programmatically. An option `--legacy-paste` is provided to change the behavior programmatically. An option `--legacy-paste` is provided to change the behavior
of <kbd>Ctrl</kbd>+<kbd>v</kbd> and <kbd>MOD</kbd>+<kbd>v</kbd> so that they of <kbd>Ctrl</kbd>+<kbd>v</kbd> and <kbd>MOD</kbd>+<kbd>v</kbd> so that they
also inject the computer clipboard text as a sequence of key events (the same also inject the computer clipboard text as a sequence of key events (the same
@ -818,29 +820,29 @@ To disable automatic clipboard synchronization, use
To simulate "pinch-to-zoom": <kbd>Ctrl</kbd>+_click-and-move_. To simulate "pinch-to-zoom": <kbd>Ctrl</kbd>+_click-and-move_.
More precisely, hold <kbd>Ctrl</kbd> while pressing the left-click button. Until More precisely, hold down <kbd>Ctrl</kbd> while pressing the left-click button.
the left-click button is released, all mouse movements scale and rotate the Until the left-click button is released, all mouse movements scale and rotate
content (if supported by the app) relative to the center of the screen. the content (if supported by the app) relative to the center of the screen.
Concretely, scrcpy generates additional touch events from a "virtual finger" at Technically, _scrcpy_ generates additional touch events from a "virtual finger"
a location inverted through the center of the screen. at a location inverted through the center of the screen.
#### Physical keyboard simulation (HID) #### Physical keyboard simulation (HID)
By default, scrcpy uses Android key or text injection: it works everywhere, but By default, _scrcpy_ uses Android key or text injection: it works everywhere,
is limited to ASCII. but is limited to ASCII.
Alternatively, scrcpy can simulate a physical USB keyboard on Android to provide Alternatively, `scrcpy` can simulate a physical USB keyboard on Android to
a better input experience (using [USB HID over AOAv2][hid-aoav2]): the virtual provide a better input experience (using [USB HID over AOAv2][hid-aoav2]): the
keyboard is disabled and it works for all characters and IME. virtual keyboard is disabled and it works for all characters and IME.
[hid-aoav2]: https://source.android.com/devices/accessories/aoa2#hid-support [hid-aoav2]: https://source.android.com/devices/accessories/aoa2#hid-support
However, it only works if the device is connected by USB. However, it only works if the device is connected via USB.
Note: On Windows, it may only work in [OTG mode](#otg), not while mirroring (it Note: On Windows, it may only work in [OTG mode](#otg), not while mirroring (it
is not possible to open a USB device if it is already open by another process is not possible to open a USB device if it is already open by another process
like the adb daemon). like the _adb daemon_).
To enable this mode: To enable this mode:
@ -851,7 +853,7 @@ scrcpy -K # short version
If it fails for some reason (for example because the device is not connected via If it fails for some reason (for example because the device is not connected via
USB), it automatically fallbacks to the default mode (with a log in the USB), it automatically fallbacks to the default mode (with a log in the
console). This allows to use the same command line options when connected over console). This allows using the same command line options when connected over
USB and TCP/IP. USB and TCP/IP.
In this mode, raw key events (scancodes) are sent to the device, independently In this mode, raw key events (scancodes) are sent to the device, independently
@ -875,7 +877,7 @@ a physical keyboard is connected).
Similarly to the physical keyboard simulation, it is possible to simulate a Similarly to the physical keyboard simulation, it is possible to simulate a
physical mouse. Likewise, it only works if the device is connected by USB. physical mouse. Likewise, it only works if the device is connected by USB.
By default, scrcpy uses Android mouse events injection, using absolute By default, _scrcpy_ uses Android mouse events injection with absolute
coordinates. By simulating a physical mouse, a mouse pointer appears on the coordinates. By simulating a physical mouse, a mouse pointer appears on the
Android device, and relative mouse motion, clicks and scrolls are injected. Android device, and relative mouse motion, clicks and scrolls are injected.
@ -886,7 +888,7 @@ scrcpy --hid-mouse
scrcpy -M # short version scrcpy -M # short version
``` ```
You could also add `--forward-all-clicks` to [forward all mouse You can also add `--forward-all-clicks` to [forward all mouse
buttons][forward_all_clicks]. buttons][forward_all_clicks].
[forward_all_clicks]: #right-click-and-middle-click [forward_all_clicks]: #right-click-and-middle-click
@ -905,7 +907,7 @@ It is possible to run _scrcpy_ with only physical keyboard and mouse simulation
(HID), as if the computer keyboard and mouse were plugged directly to the device (HID), as if the computer keyboard and mouse were plugged directly to the device
via an OTG cable. via an OTG cable.
In this mode, _adb_ (USB debugging) is not necessary, and mirroring is disabled. In this mode, `adb` (USB debugging) is not necessary, and mirroring is disabled.
To enable OTG mode: To enable OTG mode:
@ -931,7 +933,7 @@ connected by USB.
#### Text injection preference #### Text injection preference
There are two kinds of [events][textevents] generated when typing text: Two kinds of [events][textevents] are generated when typing text:
- _key events_, signaling that a key is pressed or released; - _key events_, signaling that a key is pressed or released;
- _text events_, signaling that a text has been entered. - _text events_, signaling that a text has been entered.
@ -1075,7 +1077,7 @@ _³4th and 5th mouse buttons, if your mouse has them._
_⁴For react-native apps in development, `MENU` triggers development menu._ _⁴For react-native apps in development, `MENU` triggers development menu._
_⁵Only on Android >= 7._ _⁵Only on Android >= 7._
Shortcuts with repeated keys are executted by releasing and pressing the key a Shortcuts with repeated keys are executed by releasing and pressing the key a
second time. For example, to execute "Expand settings panel": second time. For example, to execute "Expand settings panel":
1. Press and keep pressing <kbd>MOD</kbd>. 1. Press and keep pressing <kbd>MOD</kbd>.
@ -1088,7 +1090,7 @@ handled by the active application.
## Custom paths ## Custom paths
To use a specific _adb_ binary, configure its path in the environment variable To use a specific `adb` binary, configure its path in the environment variable
`ADB`: `ADB`:
```bash ```bash
@ -1101,7 +1103,7 @@ To override the path of the `scrcpy-server` file, configure its path in
To override the icon, configure its path in `SCRCPY_ICON_PATH`. To override the icon, configure its path in `SCRCPY_ICON_PATH`.
## Why _scrcpy_? ## Why the name _scrcpy_?
A colleague challenged me to find a name as unpronounceable as [gnirehtet]. A colleague challenged me to find a name as unpronounceable as [gnirehtet].
@ -1118,7 +1120,7 @@ See [BUILD].
## Common issues ## Common issues
See the [FAQ].md). See the [FAQ].
[FAQ]: FAQ.md [FAQ]: FAQ.md
@ -1161,7 +1163,7 @@ If you encounter a bug, please read the [FAQ] first, then open an [issue].
[issue]: https://github.com/Genymobile/scrcpy/issues [issue]: https://github.com/Genymobile/scrcpy/issues
For general questions or discussions, you could also use: For general questions or discussions, you can also use:
- Reddit: [`r/scrcpy`](https://www.reddit.com/r/scrcpy) - Reddit: [`r/scrcpy`](https://www.reddit.com/r/scrcpy)
- Twitter: [`@scrcpy_app`](https://twitter.com/scrcpy_app) - Twitter: [`@scrcpy_app`](https://twitter.com/scrcpy_app)
@ -1172,7 +1174,7 @@ This README is available in other languages:
- [Deutsch (German, `de`) - v1.22](README.de.md) - [Deutsch (German, `de`) - v1.22](README.de.md)
- [Indonesian (Indonesia, `id`) - v1.16](README.id.md) - [Indonesian (Indonesia, `id`) - v1.16](README.id.md)
- [Italiano (Italiano, `it`) - v1.19](README.it.md) - [Italiano (Italiano, `it`) - v1.23](README.it.md)
- [日本語 (Japanese, `jp`) - v1.19](README.jp.md) - [日本語 (Japanese, `jp`) - v1.19](README.jp.md)
- [한국어 (Korean, `ko`) - v1.11](README.ko.md) - [한국어 (Korean, `ko`) - v1.11](README.ko.md)
- [Português Brasileiro (Brazilian Portuguese, `pt-BR`) - v1.19](README.pt-br.md) - [Português Brasileiro (Brazilian Portuguese, `pt-BR`) - v1.19](README.pt-br.md)

View file

@ -704,11 +704,11 @@ scrcpy --disable-screensaver
#### 双指缩放 #### 双指缩放
模拟“双指缩放”:<kbd>Ctrl</kbd>+_按住并移动鼠标_。 模拟“双指缩放”:<kbd>Ctrl</kbd>+_按下并拖动鼠标_。
更准确的说,按住鼠标左键时按住 <kbd>Ctrl</kbd>。直到松开鼠标左键,所有鼠标移动将以屏幕中心为原点,缩放或旋转内容 (如果应用支持)。 在按住 <kbd>Ctrl</kbd> 时按下鼠标左键,直到松开鼠标左键前,移动鼠标会使屏幕内容相对于屏幕中心进行缩放或旋转 (如果应用支持)。
实际上_scrcpy_ 会在关于屏幕中心对称的位置上用“虚拟手指”发出触摸事件。 具体来说_scrcpy_ 会在鼠标位置,以及鼠标以屏幕中心镜像的位置分别生成触摸事件。
#### 物理键盘模拟 (HID) #### 物理键盘模拟 (HID)