diff options
Diffstat (limited to 'adb')
-rw-r--r-- | adb/Android.mk | 7 | ||||
-rw-r--r-- | adb/SERVICES.TXT | 5 | ||||
-rw-r--r-- | adb/adb.c | 80 | ||||
-rw-r--r-- | adb/adb.h | 10 | ||||
-rw-r--r-- | adb/adb_client.c | 4 | ||||
-rw-r--r-- | adb/commandline.c | 2 | ||||
-rw-r--r-- | adb/file_sync_client.c | 2 | ||||
-rw-r--r-- | adb/file_sync_service.c | 74 | ||||
-rw-r--r-- | adb/framebuffer_service.c | 16 | ||||
-rw-r--r-- | adb/log_service.c | 92 | ||||
-rw-r--r-- | adb/services.c | 10 | ||||
-rw-r--r-- | adb/sockets.c | 59 | ||||
-rw-r--r-- | adb/transport.c | 6 | ||||
-rw-r--r-- | adb/transport_local.c | 6 | ||||
-rw-r--r-- | adb/usb_linux.c | 2 | ||||
-rw-r--r-- | adb/usb_linux_client.c | 45 | ||||
-rwxr-xr-x[-rw-r--r--] | adb/usb_vendors.c | 326 |
17 files changed, 417 insertions, 329 deletions
diff --git a/adb/Android.mk b/adb/Android.mk index 721b48d..62f012c 100644 --- a/adb/Android.mk +++ b/adb/Android.mk @@ -34,7 +34,7 @@ endif ifeq ($(HOST_OS),windows) USB_SRCS := usb_windows.c - EXTRA_SRCS := get_my_path_windows.c ../libcutils/list.c + EXTRA_SRCS := get_my_path_windows.c EXTRA_STATIC_LIBS := AdbWinApi ifneq ($(strip $(USE_CYGWIN)),) # Pure cygwin case @@ -114,8 +114,7 @@ LOCAL_SRC_FILES := \ jdwp_service.c \ framebuffer_service.c \ remount_service.c \ - usb_linux_client.c \ - log_service.c + usb_linux_client.c LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE @@ -130,7 +129,7 @@ LOCAL_FORCE_STATIC_EXECUTABLE := true LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) -LOCAL_STATIC_LIBRARIES := liblog libcutils libc libmincrypt +LOCAL_STATIC_LIBRARIES := liblog libcutils libc libmincrypt libselinux include $(BUILD_EXECUTABLE) diff --git a/adb/SERVICES.TXT b/adb/SERVICES.TXT index 5966686..7f85dc3 100644 --- a/adb/SERVICES.TXT +++ b/adb/SERVICES.TXT @@ -198,11 +198,6 @@ localfilesystem:<path> Variants of local:<path> that are used to access other Android socket namespaces. -log:<name> - Opens one of the system logs (/dev/log/<name>) and allows the client - to read them directly. Used to implement 'adb logcat'. The stream - will be read-only for the client. - framebuffer: This service is used to send snapshots of the framebuffer to a client. It requires sufficient privileges but works as follow: @@ -39,6 +39,8 @@ #include <sys/capability.h> #include <linux/prctl.h> #include <sys/mount.h> +#include <getopt.h> +#include <selinux/selinux.h> #else #include "usb_vendors.h" #endif @@ -54,6 +56,7 @@ static int auth_enabled = 0; #if !ADB_HOST static const char *adb_device_banner = "device"; +static const char *root_seclabel = NULL; #endif void fatal(const char *fmt, ...) @@ -562,7 +565,7 @@ void handle_packet(apacket *p, atransport *t) break; case A_OPEN: /* OPEN(local-id, 0, "destination") */ - if (t->online) { + if (t->online && p->msg.arg0 != 0 && p->msg.arg1 == 0) { char *name = (char*) p->data; name[p->msg.data_length > 0 ? p->msg.data_length - 1 : 0] = 0; s = create_local_service_socket(name); @@ -578,28 +581,50 @@ void handle_packet(apacket *p, atransport *t) break; case A_OKAY: /* READY(local-id, remote-id, "") */ - if (t->online) { - if((s = find_local_socket(p->msg.arg1))) { + if (t->online && p->msg.arg0 != 0 && p->msg.arg1 != 0) { + if((s = find_local_socket(p->msg.arg1, 0))) { if(s->peer == 0) { + /* On first READY message, create the connection. */ s->peer = create_remote_socket(p->msg.arg0, t); s->peer->peer = s; + s->ready(s); + } else if (s->peer->id == p->msg.arg0) { + /* Other READY messages must use the same local-id */ + s->ready(s); + } else { + D("Invalid A_OKAY(%d,%d), expected A_OKAY(%d,%d) on transport %s\n", + p->msg.arg0, p->msg.arg1, s->peer->id, p->msg.arg1, t->serial); } - s->ready(s); } } break; - case A_CLSE: /* CLOSE(local-id, remote-id, "") */ - if (t->online) { - if((s = find_local_socket(p->msg.arg1))) { - s->close(s); + case A_CLSE: /* CLOSE(local-id, remote-id, "") or CLOSE(0, remote-id, "") */ + if (t->online && p->msg.arg1 != 0) { + if((s = find_local_socket(p->msg.arg1, p->msg.arg0))) { + /* According to protocol.txt, p->msg.arg0 might be 0 to indicate + * a failed OPEN only. However, due to a bug in previous ADB + * versions, CLOSE(0, remote-id, "") was also used for normal + * CLOSE() operations. + * + * This is bad because it means a compromised adbd could + * send packets to close connections between the host and + * other devices. To avoid this, only allow this if the local + * socket has a peer on the same transport. + */ + if (p->msg.arg0 == 0 && s->peer && s->peer->transport != t) { + D("Invalid A_CLSE(0, %u) from transport %s, expected transport %s\n", + p->msg.arg1, t->serial, s->peer->transport->serial); + } else { + s->close(s); + } } } break; - case A_WRTE: - if (t->online) { - if((s = find_local_socket(p->msg.arg1))) { + case A_WRTE: /* WRITE(local-id, remote-id, <data>) */ + if (t->online && p->msg.arg0 != 0 && p->msg.arg1 != 0) { + if((s = find_local_socket(p->msg.arg1, p->msg.arg0))) { unsigned rid = p->msg.arg0; p->len = p->msg.data_length; @@ -1333,6 +1358,12 @@ int adb_main(int is_daemon, int server_port) D("Local port disabled\n"); } else { char local_name[30]; + if ((root_seclabel != NULL) && (is_selinux_enabled() > 0)) { + // b/12587913: fix setcon to allow const pointers + if (setcon((char *)root_seclabel) < 0) { + exit(1); + } + } build_local_name(local_name, sizeof(local_name), server_port); if(install_listener(local_name, "*smartsocket*", NULL, 0)) { exit(1); @@ -1619,10 +1650,6 @@ int handle_host_request(char *service, transport_type ttype, char* serial, int r return -1; } -#if !ADB_HOST -int recovery_mode = 0; -#endif - int main(int argc, char **argv) { #if ADB_HOST @@ -1634,9 +1661,26 @@ int main(int argc, char **argv) /* If adbd runs inside the emulator this will enable adb tracing via * adb-debug qemud service in the emulator. */ adb_qemu_trace_init(); - if((argc > 1) && (!strcmp(argv[1],"recovery"))) { - adb_device_banner = "recovery"; - recovery_mode = 1; + while(1) { + int c; + int option_index = 0; + static struct option opts[] = { + {"root_seclabel", required_argument, 0, 's' }, + {"device_banner", required_argument, 0, 'b' } + }; + c = getopt_long(argc, argv, "", opts, &option_index); + if (c == -1) + break; + switch (c) { + case 's': + root_seclabel = optarg; + break; + case 'b': + adb_device_banner = optarg; + break; + default: + break; + } } start_device_log(); @@ -122,6 +122,12 @@ struct asocket { */ void (*ready)(asocket *s); + /* shutdown is called by the peer before it goes away. + ** the socket should not do any further calls on its peer. + ** Always followed by a call to close. Optional, i.e. can be NULL. + */ + void (*shutdown)(asocket *s); + /* close is called by the peer when it has gone away. ** we are not allowed to make any further calls on the ** peer once our close method is called. @@ -233,7 +239,7 @@ struct alistener void print_packet(const char *label, apacket *p); -asocket *find_local_socket(unsigned id); +asocket *find_local_socket(unsigned local_id, unsigned remote_id); void install_local_socket(asocket *s); void remove_socket(asocket *s); void close_all_sockets(atransport *t); @@ -324,9 +330,7 @@ typedef enum { } BackupOperation; int backup_service(BackupOperation operation, char* args); void framebuffer_service(int fd, void *cookie); -void log_service(int fd, void *cookie); void remount_service(int fd, void *cookie); -char * get_log_file_path(const char * log_name); #endif /* packet allocator */ diff --git a/adb/adb_client.c b/adb/adb_client.c index af87d2a..586cd7b 100644 --- a/adb/adb_client.c +++ b/adb/adb_client.c @@ -278,7 +278,9 @@ int adb_connect(const char *service) return 0; fd = _adb_connect(service); - if(fd == -2) { + if(fd == -1) { + fprintf(stderr,"error: %s\n", __adb_error); + } else if(fd == -2) { fprintf(stderr,"** daemon still not running\n"); } D("adb_connect: return fd %d\n", fd); diff --git a/adb/commandline.c b/adb/commandline.c index 27a1754..c9bb437 100644 --- a/adb/commandline.c +++ b/adb/commandline.c @@ -767,7 +767,7 @@ static int restore(int argc, char** argv) { fd = adb_connect("restore:"); if (fd < 0) { - fprintf(stderr, "adb: unable to connect for backup\n"); + fprintf(stderr, "adb: unable to connect for restore\n"); adb_close(tarFd); return -1; } diff --git a/adb/file_sync_client.c b/adb/file_sync_client.c index 354d0fb..9fec081 100644 --- a/adb/file_sync_client.c +++ b/adb/file_sync_client.c @@ -642,8 +642,8 @@ static int local_build_list(copyinfo **filelist, ci = mkcopyinfo(lpath, rpath, name, 0); if(lstat(ci->src, &st)) { fprintf(stderr,"cannot stat '%s': %s\n", ci->src, strerror(errno)); + free(ci); closedir(d); - return -1; } if(!S_ISREG(st.st_mode) && !S_ISLNK(st.st_mode)) { diff --git a/adb/file_sync_service.c b/adb/file_sync_service.c index d3e841b..577fb8f 100644 --- a/adb/file_sync_service.c +++ b/adb/file_sync_service.c @@ -22,19 +22,31 @@ #include <sys/types.h> #include <dirent.h> #include <utime.h> +#include <unistd.h> #include <errno.h> - +#include <private/android_filesystem_config.h> +#include <selinux/android.h> #include "sysdeps.h" #define TRACE_TAG TRACE_SYNC #include "adb.h" #include "file_sync_service.h" +/* TODO: use fs_config to configure permissions on /data */ +static bool is_on_system(const char *name) { + const char *SYSTEM = "/system/"; + return (strncmp(SYSTEM, name, strlen(SYSTEM)) == 0); +} + static int mkdirs(char *name) { int ret; char *x = name + 1; + uid_t uid = -1; + gid_t gid = -1; + unsigned int mode = 0775; + uint64_t cap = 0; if(name[0] != '/') return -1; @@ -42,11 +54,21 @@ static int mkdirs(char *name) x = adb_dirstart(x); if(x == 0) return 0; *x = 0; - ret = adb_mkdir(name, 0775); + if (is_on_system(name)) { + fs_config(name, 1, &uid, &gid, &mode, &cap); + } + ret = adb_mkdir(name, mode); if((ret < 0) && (errno != EEXIST)) { D("mkdir(\"%s\") -> %s\n", name, strerror(errno)); *x = '/'; return ret; + } else if(ret == 0) { + ret = chown(name, uid, gid); + if (ret < 0) { + *x = '/'; + return ret; + } + selinux_android_restorecon(name); } *x++ = '/'; } @@ -110,6 +132,7 @@ static int do_list(int s, const char *path) if(writex(s, &msg.dent, sizeof(msg.dent)) || writex(s, de->d_name, len)) { + closedir(d); return -1; } } @@ -148,7 +171,8 @@ static int fail_errno(int s) return fail_message(s, strerror(errno)); } -static int handle_send_file(int s, char *path, mode_t mode, char *buffer) +static int handle_send_file(int s, char *path, uid_t uid, + gid_t gid, mode_t mode, char *buffer) { syncmsg msg; unsigned int timestamp = 0; @@ -156,8 +180,13 @@ static int handle_send_file(int s, char *path, mode_t mode, char *buffer) fd = adb_open_mode(path, O_WRONLY | O_CREAT | O_EXCL, mode); if(fd < 0 && errno == ENOENT) { - mkdirs(path); - fd = adb_open_mode(path, O_WRONLY | O_CREAT | O_EXCL, mode); + if(mkdirs(path) != 0) { + if(fail_errno(s)) + return -1; + fd = -1; + } else { + fd = adb_open_mode(path, O_WRONLY | O_CREAT | O_EXCL, mode); + } } if(fd < 0 && errno == EEXIST) { fd = adb_open_mode(path, O_WRONLY, mode); @@ -166,6 +195,18 @@ static int handle_send_file(int s, char *path, mode_t mode, char *buffer) if(fail_errno(s)) return -1; fd = -1; + } else { + if(fchown(fd, uid, gid) != 0) { + fail_errno(s); + errno = 0; + } + + /* + * fchown clears the setuid bit - restore it if present. + * Ignore the result of calling fchmod. It's not supported + * by all filesystems. b/12441485 + */ + fchmod(fd, mode); } for(;;) { @@ -205,6 +246,7 @@ static int handle_send_file(int s, char *path, mode_t mode, char *buffer) if(fd >= 0) { struct utimbuf u; adb_close(fd); + selinux_android_restorecon(path); u.actime = timestamp; u.modtime = timestamp; utime(path, &u); @@ -248,7 +290,10 @@ static int handle_send_link(int s, char *path, char *buffer) ret = symlink(buffer, path); if(ret && errno == ENOENT) { - mkdirs(path); + if(mkdirs(path) != 0) { + fail_errno(s); + return -1; + } ret = symlink(buffer, path); } if(ret) { @@ -276,7 +321,7 @@ static int handle_send_link(int s, char *path, char *buffer) static int do_send(int s, char *path, char *buffer) { char *tmp; - mode_t mode; + unsigned int mode; int is_link, ret; tmp = strrchr(path,','); @@ -287,7 +332,7 @@ static int do_send(int s, char *path, char *buffer) #ifndef HAVE_SYMLINKS is_link = 0; #else - is_link = S_ISLNK(mode); + is_link = S_ISLNK((mode_t) mode); #endif mode &= 0777; } @@ -306,11 +351,22 @@ static int do_send(int s, char *path, char *buffer) #else { #endif + uid_t uid = -1; + gid_t gid = -1; + uint64_t cap = 0; + /* copy user permission bits to "group" and "other" permissions */ mode |= ((mode >> 3) & 0070); mode |= ((mode >> 3) & 0007); - ret = handle_send_file(s, path, mode, buffer); + tmp = path; + if(*tmp == '/') { + tmp++; + } + if (is_on_system(path)) { + fs_config(tmp, 0, &uid, &gid, &mode, &cap); + } + ret = handle_send_file(s, path, uid, gid, mode, buffer); } return ret; diff --git a/adb/framebuffer_service.c b/adb/framebuffer_service.c index 20c08d2..fa7fd98 100644 --- a/adb/framebuffer_service.c +++ b/adb/framebuffer_service.c @@ -55,13 +55,13 @@ struct fbinfo { void framebuffer_service(int fd, void *cookie) { struct fbinfo fbinfo; - unsigned int i; + unsigned int i, bsize; char buf[640]; int fd_screencap; int w, h, f; int fds[2]; - if (pipe(fds) < 0) goto done; + if (pipe(fds) < 0) goto pipefail; pid_t pid = fork(); if (pid < 0) goto done; @@ -164,17 +164,19 @@ void framebuffer_service(int fd, void *cookie) if(writex(fd, &fbinfo, sizeof(fbinfo))) goto done; /* write data */ - for(i = 0; i < fbinfo.size; i += sizeof(buf)) { - if(readx(fd_screencap, buf, sizeof(buf))) goto done; - if(writex(fd, buf, sizeof(buf))) goto done; + for(i = 0; i < fbinfo.size; i += bsize) { + bsize = sizeof(buf); + if (i + bsize > fbinfo.size) + bsize = fbinfo.size - i; + if(readx(fd_screencap, buf, bsize)) goto done; + if(writex(fd, buf, bsize)) goto done; } - if(readx(fd_screencap, buf, fbinfo.size % sizeof(buf))) goto done; - if(writex(fd, buf, fbinfo.size % sizeof(buf))) goto done; done: TEMP_FAILURE_RETRY(waitpid(pid, NULL, 0)); close(fds[0]); close(fds[1]); +pipefail: close(fd); } diff --git a/adb/log_service.c b/adb/log_service.c deleted file mode 100644 index af24356..0000000 --- a/adb/log_service.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include <stdlib.h> -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/socket.h> -#include <log/logger.h> -#include "sysdeps.h" -#include "adb.h" - -#define LOG_FILE_DIR "/dev/log/" - -void write_log_entry(int fd, struct logger_entry *buf); - -void log_service(int fd, void *cookie) -{ - /* get the name of the log filepath to read */ - char * log_filepath = cookie; - - /* open the log file. */ - int logfd = unix_open(log_filepath, O_RDONLY); - if (logfd < 0) { - goto done; - } - - // temp buffer to read the entries - unsigned char buf[LOGGER_ENTRY_MAX_LEN + 1] __attribute__((aligned(4))); - struct logger_entry *entry = (struct logger_entry *) buf; - - while (1) { - int ret; - - ret = unix_read(logfd, entry, LOGGER_ENTRY_MAX_LEN); - if (ret < 0) { - if (errno == EINTR || errno == EAGAIN) - continue; - // perror("logcat read"); - goto done; - } - else if (!ret) { - // fprintf(stderr, "read: Unexpected EOF!\n"); - goto done; - } - - /* NOTE: driver guarantees we read exactly one full entry */ - - entry->msg[entry->len] = '\0'; - - write_log_entry(fd, entry); - } - -done: - unix_close(fd); - free(log_filepath); -} - -/* returns the full path to the log file in a newly allocated string */ -char * get_log_file_path(const char * log_name) { - char *log_device = malloc(strlen(LOG_FILE_DIR) + strlen(log_name) + 1); - - strcpy(log_device, LOG_FILE_DIR); - strcat(log_device, log_name); - - return log_device; -} - - -/* prints one log entry into the file descriptor fd */ -void write_log_entry(int fd, struct logger_entry *buf) -{ - size_t size = sizeof(struct logger_entry) + buf->len; - - writex(fd, buf, size); -} diff --git a/adb/services.c b/adb/services.c index 89e595c..dcaf276 100644 --- a/adb/services.c +++ b/adb/services.c @@ -86,7 +86,7 @@ void restart_tcp_service(int fd, void *cookie) { char buf[100]; char value[PROPERTY_VALUE_MAX]; - int port = (int)cookie; + int port = (int) (uintptr_t) cookie; if (port <= 0) { snprintf(buf, sizeof(buf), "invalid port\n"); @@ -256,7 +256,7 @@ static int create_subprocess(const char *cmd, const char *arg0, const char *arg1 #if !ADB_HOST static void subproc_waiter_service(int fd, void *cookie) { - pid_t pid = (pid_t)cookie; + pid_t pid = (pid_t) (uintptr_t) cookie; D("entered. fd=%d of pid=%d\n", fd, pid); for (;;) { @@ -301,7 +301,7 @@ static int create_subproc_thread(const char *name) sti = malloc(sizeof(stinfo)); if(sti == 0) fatal("cannot allocate stinfo"); sti->func = subproc_waiter_service; - sti->cookie = (void*)pid; + sti->cookie = (void*) (uintptr_t) pid; sti->fd = ret_fd; if(adb_thread_create( &t, service_bootstrap_func, sti)){ @@ -355,8 +355,6 @@ int service_to_fd(const char *name) ret = create_service_thread(framebuffer_service, 0); } else if (!strncmp(name, "jdwp:", 5)) { ret = create_jdwp_connection_fd(atoi(name+5)); - } else if (!strncmp(name, "log:", 4)) { - ret = create_service_thread(log_service, get_log_file_path(name + 4)); } else if(!HOST && !strncmp(name, "shell:", 6)) { if(name[6]) { ret = create_subproc_thread(name + 6); @@ -384,7 +382,7 @@ int service_to_fd(const char *name) if (sscanf(name + 6, "%d", &port) == 0) { port = 0; } - ret = create_service_thread(restart_tcp_service, (void *)port); + ret = create_service_thread(restart_tcp_service, (void *) (uintptr_t) port); } else if(!strncmp(name, "usb:", 4)) { ret = create_service_thread(restart_usb_service, NULL); #endif diff --git a/adb/sockets.c b/adb/sockets.c index f17608b..de14a22 100644 --- a/adb/sockets.c +++ b/adb/sockets.c @@ -59,17 +59,22 @@ static asocket local_socket_closing_list = { .prev = &local_socket_closing_list, }; -asocket *find_local_socket(unsigned id) +// Parse the global list of sockets to find one with id |local_id|. +// If |peer_id| is not 0, also check that it is connected to a peer +// with id |peer_id|. Returns an asocket handle on success, NULL on failure. +asocket *find_local_socket(unsigned local_id, unsigned peer_id) { asocket *s; asocket *result = NULL; adb_mutex_lock(&socket_list_lock); for (s = local_socket_list.next; s != &local_socket_list; s = s->next) { - if (s->id == id) { + if (s->id != local_id) + continue; + if (peer_id == 0 || (s->peer && s->peer->id == peer_id)) { result = s; - break; } + break; } adb_mutex_unlock(&socket_list_lock); @@ -91,6 +96,11 @@ void install_local_socket(asocket *s) adb_mutex_lock(&socket_list_lock); s->id = local_socket_next_id++; + + // Socket ids should never be 0. + if (local_socket_next_id == 0) + local_socket_next_id = 1; + insert_local_socket(s, &local_socket_list); adb_mutex_unlock(&socket_list_lock); @@ -230,6 +240,12 @@ static void local_socket_close_locked(asocket *s) if(s->peer) { D("LS(%d): closing peer. peer->id=%d peer->fd=%d\n", s->id, s->peer->id, s->peer->fd); + /* Note: it's important to call shutdown before disconnecting from + * the peer, this ensures that remote sockets can still get the id + * of the local socket they're connected to, to send a CLOSE() + * protocol event. */ + if (s->peer->shutdown) + s->peer->shutdown(s->peer); s->peer->peer = 0; // tweak to avoid deadlock if (s->peer->close == local_socket_close) { @@ -326,7 +342,7 @@ static void local_socket_event_func(int fd, unsigned ev, void *_s) while(avail > 0) { r = adb_read(fd, x, avail); - D("LS(%d): post adb_read(fd=%d,...) r=%d (errno=%d) avail=%d\n", s->id, s->fd, r, r<0?errno:0, avail); + D("LS(%d): post adb_read(fd=%d,...) r=%d (errno=%d) avail=%zu\n", s->id, s->fd, r, r<0?errno:0, avail); if(r > 0) { avail -= r; x += r; @@ -397,6 +413,7 @@ asocket *create_local_socket(int fd) s->fd = fd; s->enqueue = local_socket_enqueue; s->ready = local_socket_ready; + s->shutdown = NULL; s->close = local_socket_close; install_local_socket(s); @@ -485,21 +502,29 @@ static void remote_socket_ready(asocket *s) send_packet(p, s->transport); } -static void remote_socket_close(asocket *s) +static void remote_socket_shutdown(asocket *s) { - D("entered remote_socket_close RS(%d) CLOSE fd=%d peer->fd=%d\n", + D("entered remote_socket_shutdown RS(%d) CLOSE fd=%d peer->fd=%d\n", s->id, s->fd, s->peer?s->peer->fd:-1); apacket *p = get_apacket(); p->msg.command = A_CLSE; if(s->peer) { p->msg.arg0 = s->peer->id; + } + p->msg.arg1 = s->id; + send_packet(p, s->transport); +} + +static void remote_socket_close(asocket *s) +{ + if (s->peer) { s->peer->peer = 0; D("RS(%d) peer->close()ing peer->id=%d peer->fd=%d\n", s->id, s->peer->id, s->peer->fd); s->peer->close(s->peer); } - p->msg.arg1 = s->id; - send_packet(p, s->transport); + D("entered remote_socket_close RS(%d) CLOSE fd=%d peer->fd=%d\n", + s->id, s->fd, s->peer?s->peer->fd:-1); D("RS(%d): closed\n", s->id); remove_transport_disconnect( s->transport, &((aremotesocket*)s)->disconnect ); free(s); @@ -519,15 +544,24 @@ static void remote_socket_disconnect(void* _s, atransport* t) free(s); } +/* Create an asocket to exchange packets with a remote service through transport + |t|. Where |id| is the socket id of the corresponding service on the other + side of the transport (it is allocated by the remote side and _cannot_ be 0). + Returns a new non-NULL asocket handle. */ asocket *create_remote_socket(unsigned id, atransport *t) { - asocket *s = calloc(1, sizeof(aremotesocket)); - adisconnect* dis = &((aremotesocket*)s)->disconnect; + asocket* s; + adisconnect* dis; + + if (id == 0) fatal("invalid remote socket id (0)"); + s = calloc(1, sizeof(aremotesocket)); + dis = &((aremotesocket*)s)->disconnect; if (s == NULL) fatal("cannot allocate socket"); s->id = id; s->enqueue = remote_socket_enqueue; s->ready = remote_socket_ready; + s->shutdown = remote_socket_shutdown; s->close = remote_socket_close; s->transport = t; @@ -562,6 +596,7 @@ void connect_to_remote(asocket *s, const char *destination) static void local_socket_ready_notify(asocket *s) { s->ready = local_socket_ready; + s->shutdown = NULL; s->close = local_socket_close; adb_write(s->fd, "OKAY", 4); s->ready(s); @@ -573,6 +608,7 @@ static void local_socket_ready_notify(asocket *s) static void local_socket_close_notify(asocket *s) { s->ready = local_socket_ready; + s->shutdown = NULL; s->close = local_socket_close; sendfailmsg(s->fd, "closed"); s->close(s); @@ -767,6 +803,7 @@ static int smart_socket_enqueue(asocket *s, apacket *p) adb_write(s->peer->fd, "OKAY", 4); s->peer->ready = local_socket_ready; + s->peer->shutdown = NULL; s->peer->close = local_socket_close; s->peer->peer = s2; s2->peer = s->peer; @@ -806,6 +843,7 @@ static int smart_socket_enqueue(asocket *s, apacket *p) ** tear down */ s->peer->ready = local_socket_ready_notify; + s->peer->shutdown = NULL; s->peer->close = local_socket_close_notify; s->peer->peer = 0; /* give him our transport and upref it */ @@ -851,6 +889,7 @@ static asocket *create_smart_socket(void) if (s == NULL) fatal("cannot allocate socket"); s->enqueue = smart_socket_enqueue; s->ready = smart_socket_ready; + s->shutdown = NULL; s->close = smart_socket_close; D("SS(%d)\n", s->id); diff --git a/adb/transport.c b/adb/transport.c index 224fe55..6002530 100644 --- a/adb/transport.c +++ b/adb/transport.c @@ -1142,9 +1142,9 @@ int readx(int fd, void *ptr, size_t len) char *p = ptr; int r; #if ADB_TRACE - int len0 = len; + size_t len0 = len; #endif - D("readx: fd=%d wanted=%d\n", fd, (int)len); + D("readx: fd=%d wanted=%zu\n", fd, len); while(len > 0) { r = adb_read(fd, p, len); if(r > 0) { @@ -1163,7 +1163,7 @@ int readx(int fd, void *ptr, size_t len) } #if ADB_TRACE - D("readx: fd=%d wanted=%d got=%d\n", fd, len0, len0 - len); + D("readx: fd=%d wanted=%zu got=%zu\n", fd, len0, len0 - len); dump_hex( ptr, len0 ); #endif return 0; diff --git a/adb/transport_local.c b/adb/transport_local.c index 1cfa24d..d2dbca6 100644 --- a/adb/transport_local.c +++ b/adb/transport_local.c @@ -159,7 +159,7 @@ static void *server_socket_thread(void * arg) int serverfd, fd; struct sockaddr addr; socklen_t alen; - int port = (int)arg; + int port = (int) (uintptr_t) arg; D("transport: server_socket_thread() starting\n"); serverfd = -1; @@ -241,7 +241,7 @@ static const char _start_req[] = "start"; /* 'ok' reply from the adb QEMUD service. */ static const char _ok_resp[] = "ok"; - const int port = (int)arg; + const int port = (int) (uintptr_t) arg; int res, fd; char tmp[256]; char con_name[32]; @@ -326,7 +326,7 @@ void local_init(int port) D("transport: local %s init\n", HOST ? "client" : "server"); - if(adb_thread_create(&thr, func, (void *)port)) { + if(adb_thread_create(&thr, func, (void *) (uintptr_t) port)) { fatal_errno("cannot create local socket %s thread", HOST ? "client" : "server"); } diff --git a/adb/usb_linux.c b/adb/usb_linux.c index 7bf2057..8ff753e 100644 --- a/adb/usb_linux.c +++ b/adb/usb_linux.c @@ -179,7 +179,7 @@ static void find_usb_device(const char *base, // should have device and configuration descriptors, and atleast two endpoints if (desclength < USB_DT_DEVICE_SIZE + USB_DT_CONFIG_SIZE) { - D("desclength %d is too small\n", desclength); + D("desclength %zu is too small\n", desclength); adb_close(fd); continue; } diff --git a/adb/usb_linux_client.c b/adb/usb_linux_client.c index fb1dad0..8426e0e 100644 --- a/adb/usb_linux_client.c +++ b/adb/usb_linux_client.c @@ -264,23 +264,25 @@ static void init_functionfs(struct usb_handle *h) { ssize_t ret; - D("OPENING %s\n", USB_FFS_ADB_EP0); - h->control = adb_open(USB_FFS_ADB_EP0, O_RDWR); - if (h->control < 0) { - D("[ %s: cannot open control endpoint: errno=%d]\n", USB_FFS_ADB_EP0, errno); - goto err; - } + if (h->control < 0) { // might have already done this before + D("OPENING %s\n", USB_FFS_ADB_EP0); + h->control = adb_open(USB_FFS_ADB_EP0, O_RDWR); + if (h->control < 0) { + D("[ %s: cannot open control endpoint: errno=%d]\n", USB_FFS_ADB_EP0, errno); + goto err; + } - ret = adb_write(h->control, &descriptors, sizeof(descriptors)); - if (ret < 0) { - D("[ %s: write descriptors failed: errno=%d ]\n", USB_FFS_ADB_EP0, errno); - goto err; - } + ret = adb_write(h->control, &descriptors, sizeof(descriptors)); + if (ret < 0) { + D("[ %s: write descriptors failed: errno=%d ]\n", USB_FFS_ADB_EP0, errno); + goto err; + } - ret = adb_write(h->control, &strings, sizeof(strings)); - if (ret < 0) { - D("[ %s: writing strings failed: errno=%d]\n", USB_FFS_ADB_EP0, errno); - goto err; + ret = adb_write(h->control, &strings, sizeof(strings)); + if (ret < 0) { + D("[ %s: writing strings failed: errno=%d]\n", USB_FFS_ADB_EP0, errno); + goto err; + } } h->bulk_out = adb_open(USB_FFS_ADB_OUT, O_RDWR); @@ -320,14 +322,14 @@ static void *usb_ffs_open_thread(void *x) while (1) { // wait until the USB device needs opening adb_mutex_lock(&usb->lock); - while (usb->control != -1) + while (usb->control != -1 && usb->bulk_in != -1 && usb->bulk_out != -1) adb_cond_wait(&usb->notify, &usb->lock); adb_mutex_unlock(&usb->lock); while (1) { init_functionfs(usb); - if (usb->control >= 0) + if (usb->control >= 0 && usb->bulk_in >= 0 && usb->bulk_out >= 0) break; adb_sleep_ms(1000); @@ -384,7 +386,7 @@ static int bulk_read(int bulk_out, char *buf, size_t length) ret = adb_read(bulk_out, buf + count, length - count); if (ret < 0) { if (errno != EINTR) { - D("[ bulk_read failed fd=%d length=%d count=%d ]\n", + D("[ bulk_read failed fd=%d length=%zu count=%zu ]\n", bulk_out, length, count); return ret; } @@ -424,10 +426,13 @@ static void usb_ffs_kick(usb_handle *h) D("[ kick: sink (fd=%d) clear halt failed (%d) ]", h->bulk_out, errno); adb_mutex_lock(&h->lock); - adb_close(h->control); + + // don't close ep0 here, since we may not need to reinitialize it with + // the same descriptors again. if however ep1/ep2 fail to re-open in + // init_functionfs, only then would we close and open ep0 again. adb_close(h->bulk_out); adb_close(h->bulk_in); - h->control = h->bulk_out = h->bulk_in = -1; + h->bulk_out = h->bulk_in = -1; // notify usb_ffs_open_thread that we are disconnected adb_cond_signal(&h->notify); diff --git a/adb/usb_vendors.c b/adb/usb_vendors.c index 68bb232..cd5885e 100644..100755 --- a/adb/usb_vendors.c +++ b/adb/usb_vendors.c @@ -35,191 +35,227 @@ #define TRACE_TAG TRACE_USB -// Google's USB Vendor ID -#define VENDOR_ID_GOOGLE 0x18d1 -// Intel's USB Vendor ID -#define VENDOR_ID_INTEL 0x8087 -// HTC's USB Vendor ID -#define VENDOR_ID_HTC 0x0bb4 -// Samsung's USB Vendor ID -#define VENDOR_ID_SAMSUNG 0x04e8 -// Motorola's USB Vendor ID -#define VENDOR_ID_MOTOROLA 0x22b8 -// LG's USB Vendor ID -#define VENDOR_ID_LGE 0x1004 -// Huawei's USB Vendor ID -#define VENDOR_ID_HUAWEI 0x12D1 +/* Keep the list below sorted alphabetically by #define name */ // Acer's USB Vendor ID #define VENDOR_ID_ACER 0x0502 -// Sony Ericsson's USB Vendor ID -#define VENDOR_ID_SONY_ERICSSON 0x0FCE -// Foxconn's USB Vendor ID -#define VENDOR_ID_FOXCONN 0x0489 -// Dell's USB Vendor ID -#define VENDOR_ID_DELL 0x413c -// Nvidia's USB Vendor ID -#define VENDOR_ID_NVIDIA 0x0955 -// Garmin-Asus's USB Vendor ID -#define VENDOR_ID_GARMIN_ASUS 0x091E -// Sharp's USB Vendor ID -#define VENDOR_ID_SHARP 0x04dd -// ZTE's USB Vendor ID -#define VENDOR_ID_ZTE 0x19D2 -// Kyocera's USB Vendor ID -#define VENDOR_ID_KYOCERA 0x0482 -// Pantech's USB Vendor ID -#define VENDOR_ID_PANTECH 0x10A9 -// Qualcomm's USB Vendor ID -#define VENDOR_ID_QUALCOMM 0x05c6 -// On-The-Go-Video's USB Vendor ID -#define VENDOR_ID_OTGV 0x2257 -// NEC's USB Vendor ID -#define VENDOR_ID_NEC 0x0409 -// Panasonic Mobile Communication's USB Vendor ID -#define VENDOR_ID_PMC 0x04DA -// Toshiba's USB Vendor ID -#define VENDOR_ID_TOSHIBA 0x0930 -// SK Telesys's USB Vendor ID -#define VENDOR_ID_SK_TELESYS 0x1F53 -// KT Tech's USB Vendor ID -#define VENDOR_ID_KT_TECH 0x2116 +// Allwinner's USB Vendor ID +#define VENDOR_ID_ALLWINNER 0x1F3A +// Amlogic's USB Vendor ID +#define VENDOR_ID_AMLOGIC 0x1b8e +// AnyDATA's USB Vendor ID +#define VENDOR_ID_ANYDATA 0x16D5 +// Archos's USB Vendor ID +#define VENDOR_ID_ARCHOS 0x0E79 // Asus's USB Vendor ID #define VENDOR_ID_ASUS 0x0b05 -// Philips's USB Vendor ID -#define VENDOR_ID_PHILIPS 0x0471 -// Texas Instruments's USB Vendor ID -#define VENDOR_ID_TI 0x0451 +// BYD's USB Vendor ID +#define VENDOR_ID_BYD 0x1D91 +// Compal's USB Vendor ID +#define VENDOR_ID_COMPAL 0x1219 +// Dell's USB Vendor ID +#define VENDOR_ID_DELL 0x413c +// ECS's USB Vendor ID +#define VENDOR_ID_ECS 0x03fc +// EMERGING_TECH's USB Vendor ID +#define VENDOR_ID_EMERGING_TECH 0x297F +// Emerson's USB Vendor ID +#define VENDOR_ID_EMERSON 0x2207 +// Foxconn's USB Vendor ID +#define VENDOR_ID_FOXCONN 0x0489 +// Fujitsu's USB Vendor ID +#define VENDOR_ID_FUJITSU 0x04C5 // Funai's USB Vendor ID #define VENDOR_ID_FUNAI 0x0F1C +// Garmin-Asus's USB Vendor ID +#define VENDOR_ID_GARMIN_ASUS 0x091E // Gigabyte's USB Vendor ID #define VENDOR_ID_GIGABYTE 0x0414 +// Gigaset's USB Vendor ID +#define VENDOR_ID_GIGASET 0x1E85 +// Google's USB Vendor ID +#define VENDOR_ID_GOOGLE 0x18d1 +// Haier's USB Vendor ID +#define VENDOR_ID_HAIER 0x201E +// Harris's USB Vendor ID +#define VENDOR_ID_HARRIS 0x19A5 +// Hisense's USB Vendor ID +#define VENDOR_ID_HISENSE 0x109b +// HP's USB Vendor ID +#define VENDOR_ID_HP 0x03f0 +// HTC's USB Vendor ID +#define VENDOR_ID_HTC 0x0bb4 +// Huawei's USB Vendor ID +#define VENDOR_ID_HUAWEI 0x12D1 +// INQ Mobile's USB Vendor ID +#define VENDOR_ID_INQ_MOBILE 0x2314 +// Intel's USB Vendor ID +#define VENDOR_ID_INTEL 0x8087 // IRiver's USB Vendor ID #define VENDOR_ID_IRIVER 0x2420 -// Compal's USB Vendor ID -#define VENDOR_ID_COMPAL 0x1219 -// T & A Mobile Phones' USB Vendor ID -#define VENDOR_ID_T_AND_A 0x1BBB -// LenovoMobile's USB Vendor ID -#define VENDOR_ID_LENOVOMOBILE 0x2006 -// Lenovo's USB Vendor ID -#define VENDOR_ID_LENOVO 0x17EF -// Vizio's USB Vendor ID -#define VENDOR_ID_VIZIO 0xE040 // K-Touch's USB Vendor ID #define VENDOR_ID_K_TOUCH 0x24E3 +// KT Tech's USB Vendor ID +#define VENDOR_ID_KT_TECH 0x2116 +// Kobo's USB Vendor ID +#define VENDOR_ID_KOBO 0x2237 +// Kyocera's USB Vendor ID +#define VENDOR_ID_KYOCERA 0x0482 +// Lab126's USB Vendor ID +#define VENDOR_ID_LAB126 0x1949 +// Lenovo's USB Vendor ID +#define VENDOR_ID_LENOVO 0x17EF +// LenovoMobile's USB Vendor ID +#define VENDOR_ID_LENOVOMOBILE 0x2006 +// LG's USB Vendor ID +#define VENDOR_ID_LGE 0x1004 +// Lumigon's USB Vendor ID +#define VENDOR_ID_LUMIGON 0x25E3 +// Motorola's USB Vendor ID +#define VENDOR_ID_MOTOROLA 0x22b8 +// MSI's USB Vendor ID +#define VENDOR_ID_MSI 0x0DB0 +// MTK's USB Vendor ID +#define VENDOR_ID_MTK 0x0e8d +// NEC's USB Vendor ID +#define VENDOR_ID_NEC 0x0409 +// B&N Nook's USB Vendor ID +#define VENDOR_ID_NOOK 0x2080 +// Nvidia's USB Vendor ID +#define VENDOR_ID_NVIDIA 0x0955 +// OPPO's USB Vendor ID +#define VENDOR_ID_OPPO 0x22D9 +// On-The-Go-Video's USB Vendor ID +#define VENDOR_ID_OTGV 0x2257 +// OUYA's USB Vendor ID +#define VENDOR_ID_OUYA 0x2836 +// Pantech's USB Vendor ID +#define VENDOR_ID_PANTECH 0x10A9 // Pegatron's USB Vendor ID #define VENDOR_ID_PEGATRON 0x1D4D -// Archos's USB Vendor ID -#define VENDOR_ID_ARCHOS 0x0E79 +// Philips's USB Vendor ID +#define VENDOR_ID_PHILIPS 0x0471 +// Panasonic Mobile Communication's USB Vendor ID +#define VENDOR_ID_PMC 0x04DA // Positivo's USB Vendor ID #define VENDOR_ID_POSITIVO 0x1662 -// Fujitsu's USB Vendor ID -#define VENDOR_ID_FUJITSU 0x04C5 -// Lumigon's USB Vendor ID -#define VENDOR_ID_LUMIGON 0x25E3 +// Qisda's USB Vendor ID +#define VENDOR_ID_QISDA 0x1D45 +// Qualcomm's USB Vendor ID +#define VENDOR_ID_QUALCOMM 0x05c6 // Quanta's USB Vendor ID #define VENDOR_ID_QUANTA 0x0408 -// INQ Mobile's USB Vendor ID -#define VENDOR_ID_INQ_MOBILE 0x2314 +// Rockchip's USB Vendor ID +#define VENDOR_ID_ROCKCHIP 0x2207 +// Samsung's USB Vendor ID +#define VENDOR_ID_SAMSUNG 0x04e8 +// Sharp's USB Vendor ID +#define VENDOR_ID_SHARP 0x04dd +// SK Telesys's USB Vendor ID +#define VENDOR_ID_SK_TELESYS 0x1F53 // Sony's USB Vendor ID #define VENDOR_ID_SONY 0x054C -// Lab126's USB Vendor ID -#define VENDOR_ID_LAB126 0x1949 -// Yulong Coolpad's USB Vendor ID -#define VENDOR_ID_YULONG_COOLPAD 0x1EBF -// Kobo's USB Vendor ID -#define VENDOR_ID_KOBO 0x2237 +// Sony Ericsson's USB Vendor ID +#define VENDOR_ID_SONY_ERICSSON 0x0FCE +// T & A Mobile Phones' USB Vendor ID +#define VENDOR_ID_T_AND_A 0x1BBB +// TechFaith's USB Vendor ID +#define VENDOR_ID_TECHFAITH 0x1d09 // Teleepoch's USB Vendor ID #define VENDOR_ID_TELEEPOCH 0x2340 -// AnyDATA's USB Vendor ID -#define VENDOR_ID_ANYDATA 0x16D5 -// Harris's USB Vendor ID -#define VENDOR_ID_HARRIS 0x19A5 -// OPPO's USB Vendor ID -#define VENDOR_ID_OPPO 0x22D9 +// Texas Instruments's USB Vendor ID +#define VENDOR_ID_TI 0x0451 +// Toshiba's USB Vendor ID +#define VENDOR_ID_TOSHIBA 0x0930 +// Vizio's USB Vendor ID +#define VENDOR_ID_VIZIO 0xE040 +// Wacom's USB Vendor ID +#define VENDOR_ID_WACOM 0x0531 // Xiaomi's USB Vendor ID #define VENDOR_ID_XIAOMI 0x2717 -// BYD's USB Vendor ID -#define VENDOR_ID_BYD 0x19D1 -// OUYA's USB Vendor ID -#define VENDOR_ID_OUYA 0x2836 -// Haier's USB Vendor ID -#define VENDOR_ID_HAIER 0x201E -// Hisense's USB Vendor ID -#define VENDOR_ID_HISENSE 0x109b -// MTK's USB Vendor ID -#define VENDOR_ID_MTK 0x0e8d -// B&N Nook's USB Vendor ID -#define VENDOR_ID_NOOK 0x2080 -// Qisda's USB Vendor ID -#define VENDOR_ID_QISDA 0x1D45 -// ECS's USB Vendor ID -#define VENDOR_ID_ECS 0x03fc - +// YotaDevices's USB Vendor ID +#define VENDOR_ID_YOTADEVICES 0x2916 +// Yulong Coolpad's USB Vendor ID +#define VENDOR_ID_YULONG_COOLPAD 0x1EBF +// ZTE's USB Vendor ID +#define VENDOR_ID_ZTE 0x19D2 +/* Keep the list above sorted alphabetically by #define name */ /** built-in vendor list */ +/* Keep the list below sorted alphabetically */ int builtInVendorIds[] = { - VENDOR_ID_GOOGLE, - VENDOR_ID_INTEL, - VENDOR_ID_HTC, - VENDOR_ID_SAMSUNG, - VENDOR_ID_MOTOROLA, - VENDOR_ID_LGE, - VENDOR_ID_HUAWEI, VENDOR_ID_ACER, - VENDOR_ID_SONY_ERICSSON, - VENDOR_ID_FOXCONN, - VENDOR_ID_DELL, - VENDOR_ID_NVIDIA, - VENDOR_ID_GARMIN_ASUS, - VENDOR_ID_SHARP, - VENDOR_ID_ZTE, - VENDOR_ID_KYOCERA, - VENDOR_ID_PANTECH, - VENDOR_ID_QUALCOMM, - VENDOR_ID_OTGV, - VENDOR_ID_NEC, - VENDOR_ID_PMC, - VENDOR_ID_TOSHIBA, - VENDOR_ID_SK_TELESYS, - VENDOR_ID_KT_TECH, + VENDOR_ID_ALLWINNER, + VENDOR_ID_AMLOGIC, + VENDOR_ID_ANYDATA, + VENDOR_ID_ARCHOS, VENDOR_ID_ASUS, - VENDOR_ID_PHILIPS, - VENDOR_ID_TI, + VENDOR_ID_BYD, + VENDOR_ID_COMPAL, + VENDOR_ID_DELL, + VENDOR_ID_ECS, + VENDOR_ID_EMERGING_TECH, + VENDOR_ID_EMERSON, + VENDOR_ID_FOXCONN, + VENDOR_ID_FUJITSU, VENDOR_ID_FUNAI, + VENDOR_ID_GARMIN_ASUS, VENDOR_ID_GIGABYTE, + VENDOR_ID_GIGASET, + VENDOR_ID_GOOGLE, + VENDOR_ID_HAIER, + VENDOR_ID_HARRIS, + VENDOR_ID_HISENSE, + VENDOR_ID_HP, + VENDOR_ID_HTC, + VENDOR_ID_HUAWEI, + VENDOR_ID_INQ_MOBILE, + VENDOR_ID_INTEL, VENDOR_ID_IRIVER, - VENDOR_ID_COMPAL, - VENDOR_ID_T_AND_A, - VENDOR_ID_LENOVOMOBILE, - VENDOR_ID_LENOVO, - VENDOR_ID_VIZIO, + VENDOR_ID_KOBO, VENDOR_ID_K_TOUCH, + VENDOR_ID_KT_TECH, + VENDOR_ID_KYOCERA, + VENDOR_ID_LAB126, + VENDOR_ID_LENOVO, + VENDOR_ID_LENOVOMOBILE, + VENDOR_ID_LGE, + VENDOR_ID_LUMIGON, + VENDOR_ID_MOTOROLA, + VENDOR_ID_MSI, + VENDOR_ID_MTK, + VENDOR_ID_NEC, + VENDOR_ID_NOOK, + VENDOR_ID_NVIDIA, + VENDOR_ID_OPPO, + VENDOR_ID_OTGV, + VENDOR_ID_OUYA, + VENDOR_ID_PANTECH, VENDOR_ID_PEGATRON, - VENDOR_ID_ARCHOS, + VENDOR_ID_PHILIPS, + VENDOR_ID_PMC, VENDOR_ID_POSITIVO, - VENDOR_ID_FUJITSU, - VENDOR_ID_LUMIGON, + VENDOR_ID_QISDA, + VENDOR_ID_QUALCOMM, VENDOR_ID_QUANTA, - VENDOR_ID_INQ_MOBILE, + VENDOR_ID_ROCKCHIP, + VENDOR_ID_SAMSUNG, + VENDOR_ID_SHARP, + VENDOR_ID_SK_TELESYS, VENDOR_ID_SONY, - VENDOR_ID_LAB126, - VENDOR_ID_YULONG_COOLPAD, - VENDOR_ID_KOBO, + VENDOR_ID_SONY_ERICSSON, + VENDOR_ID_T_AND_A, + VENDOR_ID_TECHFAITH, VENDOR_ID_TELEEPOCH, - VENDOR_ID_ANYDATA, - VENDOR_ID_HARRIS, - VENDOR_ID_OPPO, + VENDOR_ID_TI, + VENDOR_ID_TOSHIBA, + VENDOR_ID_VIZIO, + VENDOR_ID_WACOM, VENDOR_ID_XIAOMI, - VENDOR_ID_BYD, - VENDOR_ID_OUYA, - VENDOR_ID_HAIER, - VENDOR_ID_HISENSE, - VENDOR_ID_MTK, - VENDOR_ID_NOOK, - VENDOR_ID_QISDA, - VENDOR_ID_ECS, + VENDOR_ID_YOTADEVICES, + VENDOR_ID_YULONG_COOLPAD, + VENDOR_ID_ZTE, }; +/* Keep the list above sorted alphabetically */ #define BUILT_IN_VENDOR_COUNT (sizeof(builtInVendorIds)/sizeof(builtInVendorIds[0])) |