Compare commits
17 Commits
libusb-win
...
adb_device
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc5276b0e1 | ||
|
|
582161607e | ||
|
|
146f65d7b2 | ||
|
|
5ed13ef477 | ||
|
|
9c545e8c29 | ||
|
|
0a619dc9ef | ||
|
|
4692d13179 | ||
|
|
02d46b2262 | ||
|
|
4389de1c23 | ||
|
|
85ff70fc95 | ||
|
|
700503df6c | ||
|
|
61969aeb80 | ||
|
|
b88c4aa75e | ||
|
|
8c50342fb2 | ||
|
|
0eadf95a3e | ||
|
|
6df2205cf3 | ||
|
|
61b6324ee9 |
@@ -441,12 +441,12 @@ select it automatically:
|
||||
|
||||
```bash
|
||||
# Select the only device connected via USB
|
||||
scrcpy --select-usb
|
||||
scrcpy -U # short version
|
||||
scrcpy -d # like adb -d
|
||||
scrcpy --select-usb # long version
|
||||
|
||||
# Select the only device connected via TCP/IP
|
||||
scrcpy --select-tcpip
|
||||
scrcpy -T # short version
|
||||
scrcpy -e # like adb -e
|
||||
scrcpy --select-tcpip # long version
|
||||
```
|
||||
|
||||
You can start several instances of _scrcpy_ for several devices.
|
||||
|
||||
@@ -73,7 +73,7 @@ if v4l2_support
|
||||
src += [ 'src/v4l2_sink.c' ]
|
||||
endif
|
||||
|
||||
usb_support = host_machine.system() == 'linux' or host_machine.system() == 'windows'
|
||||
usb_support = host_machine.system() == 'linux'
|
||||
if usb_support
|
||||
src += [
|
||||
'src/usb/aoa_hid.c',
|
||||
@@ -140,22 +140,9 @@ else
|
||||
include_directories: include_directories(ffmpeg_include_dir)
|
||||
)
|
||||
|
||||
prebuilt_libusb = meson.get_cross_property('prebuilt_libusb')
|
||||
prebuilt_libusb_root = meson.get_cross_property('prebuilt_libusb_root')
|
||||
libusb_bin_dir = meson.current_source_dir() + '/../prebuilt-deps/data/' + prebuilt_libusb + '/dll'
|
||||
libusb_include_dir = '../prebuilt-deps/data/' + prebuilt_libusb_root + '/include'
|
||||
|
||||
libusb = declare_dependency(
|
||||
dependencies: [
|
||||
cc.find_library('libusb-1.0', dirs: libusb_bin_dir),
|
||||
],
|
||||
include_directories: include_directories(libusb_include_dir)
|
||||
)
|
||||
|
||||
dependencies = [
|
||||
ffmpeg,
|
||||
sdl2,
|
||||
libusb,
|
||||
cc.find_library('mingw32')
|
||||
]
|
||||
|
||||
|
||||
20
app/scrcpy.1
20
app/scrcpy.1
@@ -43,6 +43,12 @@ The values are expressed in the device natural orientation (typically, portrait
|
||||
.B \-\-max\-size
|
||||
value is computed on the cropped size.
|
||||
|
||||
.TP
|
||||
.B \-d, \-\-select\-usb
|
||||
Use USB device (if there is exactly one, like adb -d).
|
||||
|
||||
Also see \fB\-e\fR (\fB\-\-select\-tcpip\fR).
|
||||
|
||||
.TP
|
||||
.BI "\-\-disable-screensaver"
|
||||
Disable screensaver while scrcpy is running.
|
||||
@@ -62,6 +68,12 @@ Add a buffering delay (in milliseconds) before displaying. This increases latenc
|
||||
|
||||
Default is 0 (no buffering).
|
||||
|
||||
.TP
|
||||
.B \-e, \-\-select\-tcpip
|
||||
Use TCP/IP device (if there is exactly one, like adb -e).
|
||||
|
||||
Also see \fB\-d\fR (\fB\-\-select\-usb\fR).
|
||||
|
||||
.TP
|
||||
.BI "\-\-encoder " name
|
||||
Use a specific MediaCodec encoder (must be a H.264 encoder).
|
||||
@@ -273,14 +285,6 @@ Set the TCP port of the adb tunnel to reach the scrcpy server. This option autom
|
||||
|
||||
Default is 0 (not forced): the local port used for establishing the tunnel will be used.
|
||||
|
||||
.TP
|
||||
.B \-T, \-\-select\-tcpip
|
||||
Use TCP/IP device (if there is exactly one).
|
||||
|
||||
.TP
|
||||
.B \-U, \-\-select\-usb
|
||||
Use USB device (if there is exactly one).
|
||||
|
||||
.TP
|
||||
.BI "\-\-v4l2-sink " /dev/videoN
|
||||
Output to v4l2loopback device.
|
||||
|
||||
@@ -585,9 +585,8 @@ sc_adb_select_device(struct sc_intr *intr,
|
||||
break;
|
||||
}
|
||||
sc_adb_devices_log(SC_LOG_LEVEL_ERROR, devices, count);
|
||||
if (selector->type != SC_ADB_DEVICE_SELECT_ALL) {
|
||||
LOGE("Specify the device via -s or --serial");
|
||||
}
|
||||
LOGE("Select a device via -s (--serial), -d (--select-usb) or -e "
|
||||
"(--select-tcpip)");
|
||||
sc_adb_devices_destroy_all(devices, count);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ void
|
||||
sc_adb_device_destroy(struct sc_adb_device *device);
|
||||
|
||||
/**
|
||||
* Move src to dest
|
||||
* Move src to dst
|
||||
*
|
||||
* After this call, the content of src is undefined, except that
|
||||
* sc_adb_device_destroy() can be called.
|
||||
|
||||
@@ -118,6 +118,12 @@ static const struct sc_option options[] = {
|
||||
"(typically, portrait for a phone, landscape for a tablet). "
|
||||
"Any --max-size value is cmoputed on the cropped size.",
|
||||
},
|
||||
{
|
||||
.shortopt = 'd',
|
||||
.longopt = "select-usb",
|
||||
.text = "Use USB device (if there is exactly one, like adb -d).\n"
|
||||
"Also see -e (--select-tcpip).",
|
||||
},
|
||||
{
|
||||
.longopt_id = OPT_DISABLE_SCREENSAVER,
|
||||
.longopt = "disable-screensaver",
|
||||
@@ -141,6 +147,12 @@ static const struct sc_option options[] = {
|
||||
"This increases latency to compensate for jitter.\n"
|
||||
"Default is 0 (no buffering).",
|
||||
},
|
||||
{
|
||||
.shortopt = 'e',
|
||||
.longopt = "select-tcpip",
|
||||
.text = "Use TCP/IP device (if there is exactly one, like adb -e).\n"
|
||||
"Also see -d (--select-usb).",
|
||||
},
|
||||
{
|
||||
.longopt_id = OPT_ENCODER_NAME,
|
||||
.longopt = "encoder",
|
||||
@@ -416,16 +428,6 @@ static const struct sc_option options[] = {
|
||||
"Default is 0 (not forced): the local port used for "
|
||||
"establishing the tunnel will be used.",
|
||||
},
|
||||
{
|
||||
.shortopt = 'T',
|
||||
.longopt = "select-tcpip",
|
||||
.text = "Use TCP/IP device (if there is exactly one).",
|
||||
},
|
||||
{
|
||||
.shortopt = 'U',
|
||||
.longopt = "select-usb",
|
||||
.text = "Use USB device (if there is exactly one).",
|
||||
},
|
||||
{
|
||||
.longopt_id = OPT_V4L2_SINK,
|
||||
.longopt = "v4l2-sink",
|
||||
@@ -1330,6 +1332,12 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
opts->select_usb = true;
|
||||
break;
|
||||
case 'e':
|
||||
opts->select_tcpip = true;
|
||||
break;
|
||||
case 'f':
|
||||
opts->fullscreen = true;
|
||||
break;
|
||||
@@ -1411,12 +1419,6 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||
case 't':
|
||||
opts->show_touches = true;
|
||||
break;
|
||||
case 'T':
|
||||
opts->select_tcpip = true;
|
||||
break;
|
||||
case 'U':
|
||||
opts->select_usb = true;
|
||||
break;
|
||||
case OPT_ALWAYS_ON_TOP:
|
||||
opts->always_on_top = true;
|
||||
break;
|
||||
@@ -1582,8 +1584,8 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||
if (selectors > 1) {
|
||||
LOGE("At most one device selector option may be passed, among:\n"
|
||||
" --serial (-s)\n"
|
||||
" --select-usb (-U)\n"
|
||||
" --select-tcpip (-T)\n"
|
||||
" --select-usb (-d)\n"
|
||||
" --select-tcpip (-e)\n"
|
||||
" --tcpip=<addr> (with an argument)");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -89,8 +89,8 @@ scrcpy_otg(struct scrcpy_options *options) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
LOGI("USB device: %s (%04x:%04x) %s %s", usb_device.serial,
|
||||
(unsigned) usb_device.vid, (unsigned) usb_device.pid,
|
||||
LOGI("USB device: %s (%04" PRIx16 ":%04" PRIx16 ") %s %s",
|
||||
usb_device.serial, usb_device.vid, usb_device.pid,
|
||||
usb_device.manufacturer, usb_device.product);
|
||||
|
||||
ok = sc_usb_connect(&s->usb, usb_device.device, &cbs, NULL);
|
||||
|
||||
@@ -38,11 +38,6 @@ sc_usb_read_device(libusb_device *device, struct sc_usb_device *out) {
|
||||
libusb_device_handle *handle;
|
||||
result = libusb_open(device, &handle);
|
||||
if (result < 0) {
|
||||
// Log at debug level because it is expected that some non-Android USB
|
||||
// devices present on the computer require special permissions
|
||||
LOGD("Open USB device %04x:%04x: libusb error: %s",
|
||||
(unsigned) desc.idVendor, (unsigned) desc.idProduct,
|
||||
libusb_strerror(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -147,10 +142,8 @@ sc_usb_devices_log(enum sc_log_level level, struct sc_usb_device *devices,
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
struct sc_usb_device *d = &devices[i];
|
||||
const char *selection = d->selected ? "-->" : " ";
|
||||
// Convert uint16_t to unsigned because PRIx16 may not exist on Windows
|
||||
LOG(level, " %s %-18s (%04x:%04x) %s %s",
|
||||
selection, d->serial, (unsigned) d->vid, (unsigned) d->pid,
|
||||
d->manufacturer, d->product);
|
||||
LOG(level, " %s %-18s (%04" PRIx16 ":%04" PRIx16 ") %s %s",
|
||||
selection, d->serial, d->vid, d->pid, d->manufacturer, d->product);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,9 +184,7 @@ sc_usb_select_device(struct sc_usb *usb, const char *serial,
|
||||
LOGE("Multiple (%" SC_PRIsizet ") USB devices:", sel_count);
|
||||
}
|
||||
sc_usb_devices_log(SC_LOG_LEVEL_ERROR, usb_devices, count);
|
||||
if (!serial) {
|
||||
LOGE("Specify the device via -s or --serial");
|
||||
}
|
||||
LOGE("Select a device via -s (--serial)");
|
||||
sc_usb_devices_destroy_all(usb_devices, count);
|
||||
return false;
|
||||
}
|
||||
@@ -221,7 +212,7 @@ sc_usb_destroy(struct sc_usb *usb) {
|
||||
libusb_exit(usb->context);
|
||||
}
|
||||
|
||||
static LIBUSB_CALL int
|
||||
static int
|
||||
sc_usb_libusb_callback(libusb_context *ctx, libusb_device *device,
|
||||
libusb_hotplug_event event, void *userdata) {
|
||||
(void) ctx;
|
||||
|
||||
@@ -42,7 +42,7 @@ void
|
||||
sc_usb_device_destroy(struct sc_usb_device *usb_device);
|
||||
|
||||
/**
|
||||
* Move src to dest
|
||||
* Move src to dst
|
||||
*
|
||||
* After this call, the content of src is undefined, except that
|
||||
* sc_usb_device_destroy() can be called.
|
||||
|
||||
@@ -21,5 +21,3 @@ ffmpeg_avformat = 'avformat-58'
|
||||
ffmpeg_avutil = 'avutil-56'
|
||||
prebuilt_ffmpeg = 'ffmpeg-win32-4.3.1'
|
||||
prebuilt_sdl2 = 'SDL2-2.0.20/i686-w64-mingw32'
|
||||
prebuilt_libusb_root = 'libusb-1.0.25'
|
||||
prebuilt_libusb = prebuilt_libusb_root + '/MinGW32'
|
||||
|
||||
@@ -21,5 +21,3 @@ ffmpeg_avformat = 'avformat-59'
|
||||
ffmpeg_avutil = 'avutil-57'
|
||||
prebuilt_ffmpeg = 'ffmpeg-win64-5.0'
|
||||
prebuilt_sdl2 = 'SDL2-2.0.20/x86_64-w64-mingw32'
|
||||
prebuilt_libusb_root = 'libusb-1.0.25'
|
||||
prebuilt_libusb = prebuilt_libusb_root + '/MinGW64'
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
DIR=$(dirname ${BASH_SOURCE[0]})
|
||||
cd "$DIR"
|
||||
. common
|
||||
mkdir -p "$PREBUILT_DATA_DIR"
|
||||
cd "$PREBUILT_DATA_DIR"
|
||||
|
||||
DEP_DIR=libusb-1.0.25
|
||||
|
||||
FILENAME=libusb-1.0.25.7z
|
||||
SHA256SUM=3d1c98416f454026034b2b5d67f8a294053898cb70a8b489874e75b136c6674d
|
||||
|
||||
if [[ -d "$DEP_DIR" ]]
|
||||
then
|
||||
echo "$DEP_DIR" found
|
||||
exit 0
|
||||
fi
|
||||
|
||||
get_file "https://github.com/libusb/libusb/releases/download/v1.0.25/$FILENAME" "$FILENAME" "$SHA256SUM"
|
||||
|
||||
mkdir "$DEP_DIR"
|
||||
cd "$DEP_DIR"
|
||||
|
||||
7z x "../$FILENAME" \
|
||||
MinGW32/dll/libusb-1.0.dll \
|
||||
MinGW64/dll/libusb-1.0.dll \
|
||||
include /
|
||||
@@ -66,7 +66,6 @@ prepare-deps-win32:
|
||||
@prebuilt-deps/prepare-adb.sh
|
||||
@prebuilt-deps/prepare-sdl.sh
|
||||
@prebuilt-deps/prepare-ffmpeg-win32.sh
|
||||
@prebuilt-deps/prepare-libusb.sh
|
||||
|
||||
build-win32: prepare-deps-win32
|
||||
[ -d "$(WIN32_BUILD_DIR)" ] || ( mkdir "$(WIN32_BUILD_DIR)" && \
|
||||
@@ -108,7 +107,6 @@ dist-win32: build-server build-win32
|
||||
cp prebuilt-deps/data/platform-tools-31.0.3/AdbWinApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||
cp prebuilt-deps/data/platform-tools-31.0.3/AdbWinUsbApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||
cp prebuilt-deps/data/SDL2-2.0.20/i686-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||
cp prebuilt-deps/data/libusb-1.0.25/MinGW32/dll/libusb-1.0.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||
|
||||
dist-win64: build-server build-win64
|
||||
mkdir -p "$(DIST)/$(WIN64_TARGET_DIR)"
|
||||
@@ -127,7 +125,6 @@ dist-win64: build-server build-win64
|
||||
cp prebuilt-deps/data/platform-tools-31.0.3/AdbWinApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||
cp prebuilt-deps/data/platform-tools-31.0.3/AdbWinUsbApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||
cp prebuilt-deps/data/SDL2-2.0.20/x86_64-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||
cp prebuilt-deps/data/libusb-1.0.25/MinGW64/dll/libusb-1.0.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||
|
||||
zip-win32: dist-win32
|
||||
cd "$(DIST)/$(WIN32_TARGET_DIR)"; \
|
||||
|
||||
Reference in New Issue
Block a user