mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-07 00:28:58 +00:00
drag and drop to install apk files from computer
This commit is contained in:
parent
9aa88b6fc3
commit
efc75e8b45
5 changed files with 17 additions and 0 deletions
|
@ -73,6 +73,11 @@ process_t adb_push(const char *serial, const char *local, const char *remote) {
|
|||
return adb_execute(serial, adb_cmd, ARRAY_LEN(adb_cmd));
|
||||
}
|
||||
|
||||
process_t adb_install(const char *serial, const char *local, const char *remote) {
|
||||
const char *const adb_cmd[] = {"install", local, remote};
|
||||
return adb_execute(serial, adb_cmd, ARRAY_LEN(adb_cmd));
|
||||
}
|
||||
|
||||
process_t adb_remove_path(const char *serial, const char *path) {
|
||||
const char *const adb_cmd[] = {"shell", "rm", path};
|
||||
return adb_execute(serial, adb_cmd, ARRAY_LEN(adb_cmd));
|
||||
|
|
|
@ -42,6 +42,7 @@ process_t adb_forward_remove(const char *serial, uint16_t local_port);
|
|||
process_t adb_reverse(const char *serial, const char *device_socket_name, uint16_t local_port);
|
||||
process_t adb_reverse_remove(const char *serial, const char *device_socket_name);
|
||||
process_t adb_push(const char *serial, const char *local, const char *remote);
|
||||
process_t adb_install(const char *serial, const char *local, const char *remote);
|
||||
process_t adb_remove_path(const char *serial, const char *path);
|
||||
|
||||
// convenience function to wait for a successful process execution
|
||||
|
|
|
@ -102,6 +102,9 @@ static void event_loop(void) {
|
|||
case SDL_MOUSEBUTTONUP:
|
||||
input_manager_process_mouse_button(&input_manager, &event.button);
|
||||
break;
|
||||
case SDL_DROPFILE:
|
||||
server_install(&server, event.drop.file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,6 +145,11 @@ void server_init(struct server *server) {
|
|||
*server = (struct server) SERVER_INITIALIZER;
|
||||
}
|
||||
|
||||
SDL_bool server_install(struct server *server, const char* apk_path) {
|
||||
process_t process = adb_install(server->serial, apk_path, DEVICE_SERVER_PATH);
|
||||
return process_check_success(process, "adb install");
|
||||
}
|
||||
|
||||
SDL_bool server_start(struct server *server, const char *serial, Uint16 local_port,
|
||||
Uint16 max_size, Uint32 bit_rate) {
|
||||
server->local_port = local_port;
|
||||
|
|
|
@ -33,6 +33,9 @@ void server_init(struct server *server);
|
|||
SDL_bool server_start(struct server *server, const char *serial, Uint16 local_port,
|
||||
Uint16 max_size, Uint32 bit_rate);
|
||||
|
||||
// install an apk file located to apk_path
|
||||
SDL_bool server_install(struct server *server, const char* apk_path);
|
||||
|
||||
// block until the communication with the server is established
|
||||
socket_t server_connect_to(struct server *server);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue