The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef __ADB_H |
| 18 | #define __ADB_H |
| 19 | |
| 20 | #include <limits.h> |
| 21 | |
leozwang | d3fc15f | 2014-07-29 12:50:02 -0700 | [diff] [blame] | 22 | #include "adb_trace.h" |
JP Abgrall | 408fa57 | 2011-03-16 15:57:42 -0700 | [diff] [blame] | 23 | #include "transport.h" /* readx(), writex() */ |
| 24 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 25 | #define MAX_PAYLOAD 4096 |
| 26 | |
| 27 | #define A_SYNC 0x434e5953 |
| 28 | #define A_CNXN 0x4e584e43 |
| 29 | #define A_OPEN 0x4e45504f |
| 30 | #define A_OKAY 0x59414b4f |
| 31 | #define A_CLSE 0x45534c43 |
| 32 | #define A_WRTE 0x45545257 |
Benoit Goby | d5fcafa | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 33 | #define A_AUTH 0x48545541 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 34 | |
| 35 | #define A_VERSION 0x01000000 // ADB protocol version |
| 36 | |
| 37 | #define ADB_VERSION_MAJOR 1 // Used for help/version information |
| 38 | #define ADB_VERSION_MINOR 0 // Used for help/version information |
| 39 | |
Doug Zongker | 71fe584 | 2014-06-26 15:35:36 -0700 | [diff] [blame] | 40 | #define ADB_SERVER_VERSION 32 // Increment this when we want to force users to start a new adb server |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 41 | |
| 42 | typedef struct amessage amessage; |
| 43 | typedef struct apacket apacket; |
| 44 | typedef struct asocket asocket; |
| 45 | typedef struct alistener alistener; |
| 46 | typedef struct aservice aservice; |
| 47 | typedef struct atransport atransport; |
| 48 | typedef struct adisconnect adisconnect; |
| 49 | typedef struct usb_handle usb_handle; |
| 50 | |
| 51 | struct amessage { |
| 52 | unsigned command; /* command identifier constant */ |
| 53 | unsigned arg0; /* first argument */ |
| 54 | unsigned arg1; /* second argument */ |
| 55 | unsigned data_length; /* length of payload (0 is allowed) */ |
| 56 | unsigned data_check; /* checksum of data payload */ |
| 57 | unsigned magic; /* command ^ 0xffffffff */ |
| 58 | }; |
| 59 | |
| 60 | struct apacket |
| 61 | { |
| 62 | apacket *next; |
| 63 | |
| 64 | unsigned len; |
| 65 | unsigned char *ptr; |
| 66 | |
| 67 | amessage msg; |
| 68 | unsigned char data[MAX_PAYLOAD]; |
| 69 | }; |
| 70 | |
| 71 | /* An asocket represents one half of a connection between a local and |
| 72 | ** remote entity. A local asocket is bound to a file descriptor. A |
| 73 | ** remote asocket is bound to the protocol engine. |
| 74 | */ |
| 75 | struct asocket { |
| 76 | /* chain pointers for the local/remote list of |
| 77 | ** asockets that this asocket lives in |
| 78 | */ |
| 79 | asocket *next; |
| 80 | asocket *prev; |
| 81 | |
| 82 | /* the unique identifier for this asocket |
| 83 | */ |
| 84 | unsigned id; |
| 85 | |
| 86 | /* flag: set when the socket's peer has closed |
| 87 | ** but packets are still queued for delivery |
| 88 | */ |
| 89 | int closing; |
| 90 | |
Benoit Goby | f366b36 | 2012-03-16 14:50:07 -0700 | [diff] [blame] | 91 | /* flag: quit adbd when both ends close the |
| 92 | ** local service socket |
| 93 | */ |
| 94 | int exit_on_close; |
| 95 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 96 | /* the asocket we are connected to |
| 97 | */ |
| 98 | |
| 99 | asocket *peer; |
| 100 | |
| 101 | /* For local asockets, the fde is used to bind |
| 102 | ** us to our fd event system. For remote asockets |
| 103 | ** these fields are not used. |
| 104 | */ |
| 105 | fdevent fde; |
| 106 | int fd; |
| 107 | |
| 108 | /* queue of apackets waiting to be written |
| 109 | */ |
| 110 | apacket *pkt_first; |
| 111 | apacket *pkt_last; |
| 112 | |
| 113 | /* enqueue is called by our peer when it has data |
| 114 | ** for us. It should return 0 if we can accept more |
| 115 | ** data or 1 if not. If we return 1, we must call |
| 116 | ** peer->ready() when we once again are ready to |
| 117 | ** receive data. |
| 118 | */ |
| 119 | int (*enqueue)(asocket *s, apacket *pkt); |
| 120 | |
| 121 | /* ready is called by the peer when it is ready for |
| 122 | ** us to send data via enqueue again |
| 123 | */ |
| 124 | void (*ready)(asocket *s); |
| 125 | |
David 'Digit' Turner | 818d641 | 2013-12-13 14:09:44 +0100 | [diff] [blame] | 126 | /* shutdown is called by the peer before it goes away. |
| 127 | ** the socket should not do any further calls on its peer. |
| 128 | ** Always followed by a call to close. Optional, i.e. can be NULL. |
| 129 | */ |
| 130 | void (*shutdown)(asocket *s); |
| 131 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 132 | /* close is called by the peer when it has gone away. |
| 133 | ** we are not allowed to make any further calls on the |
| 134 | ** peer once our close method is called. |
| 135 | */ |
| 136 | void (*close)(asocket *s); |
| 137 | |
Benoit Goby | 9470c2f | 2013-02-20 15:04:53 -0800 | [diff] [blame] | 138 | /* A socket is bound to atransport */ |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 139 | atransport *transport; |
| 140 | }; |
| 141 | |
| 142 | |
| 143 | /* the adisconnect structure is used to record a callback that |
| 144 | ** will be called whenever a transport is disconnected (e.g. by the user) |
| 145 | ** this should be used to cleanup objects that depend on the |
| 146 | ** transport (e.g. remote sockets, listeners, etc...) |
| 147 | */ |
| 148 | struct adisconnect |
| 149 | { |
| 150 | void (*func)(void* opaque, atransport* t); |
| 151 | void* opaque; |
| 152 | adisconnect* next; |
| 153 | adisconnect* prev; |
| 154 | }; |
| 155 | |
| 156 | |
| 157 | /* a transport object models the connection to a remote device or emulator |
| 158 | ** there is one transport per connected device/emulator. a "local transport" |
| 159 | ** connects through TCP (for the emulator), while a "usb transport" through |
| 160 | ** USB (for real devices) |
| 161 | ** |
| 162 | ** note that kTransportHost doesn't really correspond to a real transport |
| 163 | ** object, it's a special value used to indicate that a client wants to |
| 164 | ** connect to a service implemented within the ADB server itself. |
| 165 | */ |
| 166 | typedef enum transport_type { |
| 167 | kTransportUsb, |
| 168 | kTransportLocal, |
| 169 | kTransportAny, |
| 170 | kTransportHost, |
| 171 | } transport_type; |
| 172 | |
Benoit Goby | d5fcafa | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 173 | #define TOKEN_SIZE 20 |
| 174 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 175 | struct atransport |
| 176 | { |
| 177 | atransport *next; |
| 178 | atransport *prev; |
| 179 | |
| 180 | int (*read_from_remote)(apacket *p, atransport *t); |
| 181 | int (*write_to_remote)(apacket *p, atransport *t); |
| 182 | void (*close)(atransport *t); |
| 183 | void (*kick)(atransport *t); |
| 184 | |
| 185 | int fd; |
| 186 | int transport_socket; |
| 187 | fdevent transport_fde; |
| 188 | int ref_count; |
| 189 | unsigned sync_token; |
| 190 | int connection_state; |
Benoit Goby | d5fcafa | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 191 | int online; |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 192 | transport_type type; |
| 193 | |
| 194 | /* usb handle or socket fd as needed */ |
| 195 | usb_handle *usb; |
| 196 | int sfd; |
| 197 | |
| 198 | /* used to identify transports for clients */ |
| 199 | char *serial; |
| 200 | char *product; |
Scott Anderson | e82c2db | 2012-05-25 14:10:02 -0700 | [diff] [blame] | 201 | char *model; |
| 202 | char *device; |
Scott Anderson | e109d26 | 2012-04-20 11:21:14 -0700 | [diff] [blame] | 203 | char *devpath; |
Stefan Hilzinger | d9d1ca4 | 2010-04-26 10:17:43 +0100 | [diff] [blame] | 204 | int adb_port; // Use for emulators (local transport) |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 205 | |
| 206 | /* a list of adisconnect callbacks called when the transport is kicked */ |
| 207 | int kicked; |
| 208 | adisconnect disconnects; |
Benoit Goby | d5fcafa | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 209 | |
| 210 | void *key; |
| 211 | unsigned char token[TOKEN_SIZE]; |
| 212 | fdevent auth_fde; |
| 213 | unsigned failed_auth_attempts; |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 214 | }; |
| 215 | |
| 216 | |
| 217 | /* A listener is an entity which binds to a local port |
| 218 | ** and, upon receiving a connection on that port, creates |
| 219 | ** an asocket to connect the new local connection to a |
| 220 | ** specific remote service. |
| 221 | ** |
| 222 | ** TODO: some listeners read from the new connection to |
| 223 | ** determine what exact service to connect to on the far |
| 224 | ** side. |
| 225 | */ |
| 226 | struct alistener |
| 227 | { |
| 228 | alistener *next; |
| 229 | alistener *prev; |
| 230 | |
| 231 | fdevent fde; |
| 232 | int fd; |
| 233 | |
| 234 | const char *local_name; |
| 235 | const char *connect_to; |
| 236 | atransport *transport; |
| 237 | adisconnect disconnect; |
| 238 | }; |
| 239 | |
| 240 | |
| 241 | void print_packet(const char *label, apacket *p); |
| 242 | |
David 'Digit' Turner | 818d641 | 2013-12-13 14:09:44 +0100 | [diff] [blame] | 243 | asocket *find_local_socket(unsigned local_id, unsigned remote_id); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 244 | void install_local_socket(asocket *s); |
| 245 | void remove_socket(asocket *s); |
| 246 | void close_all_sockets(atransport *t); |
| 247 | |
| 248 | #define LOCAL_CLIENT_PREFIX "emulator-" |
| 249 | |
| 250 | asocket *create_local_socket(int fd); |
| 251 | asocket *create_local_service_socket(const char *destination); |
| 252 | |
| 253 | asocket *create_remote_socket(unsigned id, atransport *t); |
| 254 | void connect_to_remote(asocket *s, const char *destination); |
| 255 | void connect_to_smartsocket(asocket *s); |
| 256 | |
| 257 | void fatal(const char *fmt, ...); |
| 258 | void fatal_errno(const char *fmt, ...); |
| 259 | |
| 260 | void handle_packet(apacket *p, atransport *t); |
| 261 | void send_packet(apacket *p, atransport *t); |
| 262 | |
Alexey Tarasov | 3166410 | 2009-10-22 02:55:00 +1100 | [diff] [blame] | 263 | void get_my_path(char *s, size_t maxLen); |
Stefan Hilzinger | a84a42e | 2010-04-19 12:21:12 +0100 | [diff] [blame] | 264 | int launch_server(int server_port); |
| 265 | int adb_main(int is_daemon, int server_port); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 266 | |
| 267 | |
| 268 | /* transports are ref-counted |
| 269 | ** get_device_transport does an acquire on your behalf before returning |
| 270 | */ |
| 271 | void init_transport_registration(void); |
Scott Anderson | 2ca3e6b | 2012-05-30 18:11:27 -0700 | [diff] [blame] | 272 | int list_transports(char *buf, size_t bufsize, int long_listing); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 273 | void update_transports(void); |
| 274 | |
| 275 | asocket* create_device_tracker(void); |
| 276 | |
| 277 | /* Obtain a transport from the available transports. |
| 278 | ** If state is != CS_ANY, only transports in that state are considered. |
| 279 | ** If serial is non-NULL then only the device with that serial will be chosen. |
| 280 | ** If no suitable transport is found, error is set. |
| 281 | */ |
| 282 | atransport *acquire_one_transport(int state, transport_type ttype, const char* serial, char **error_out); |
| 283 | void add_transport_disconnect( atransport* t, adisconnect* dis ); |
| 284 | void remove_transport_disconnect( atransport* t, adisconnect* dis ); |
| 285 | void run_transport_disconnects( atransport* t ); |
| 286 | void kick_transport( atransport* t ); |
| 287 | |
| 288 | /* initialize a transport object's func pointers and state */ |
Stefan Hilzinger | d9d1ca4 | 2010-04-26 10:17:43 +0100 | [diff] [blame] | 289 | #if ADB_HOST |
| 290 | int get_available_local_transport_index(); |
| 291 | #endif |
Mike Lockwood | 2f38b69 | 2009-08-24 15:58:40 -0700 | [diff] [blame] | 292 | int init_socket_transport(atransport *t, int s, int port, int local); |
Mike Lockwood | 95b837d | 2009-08-08 12:37:44 -0400 | [diff] [blame] | 293 | void init_usb_transport(atransport *t, usb_handle *usb, int state); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 294 | |
| 295 | /* for MacOS X cleanup */ |
| 296 | void close_usb_devices(); |
| 297 | |
| 298 | /* cause new transports to be init'd and added to the list */ |
Benoit Goby | 1c45ee9 | 2013-03-29 18:22:36 -0700 | [diff] [blame] | 299 | int register_socket_transport(int s, const char *serial, int port, int local); |
Mike Lockwood | 74d7ff8 | 2009-10-11 23:04:18 -0400 | [diff] [blame] | 300 | |
Mike Lockwood | cbbe79a | 2010-05-24 10:44:35 -0400 | [diff] [blame] | 301 | /* these should only be used for the "adb disconnect" command */ |
Mike Lockwood | 74d7ff8 | 2009-10-11 23:04:18 -0400 | [diff] [blame] | 302 | void unregister_transport(atransport *t); |
Mike Lockwood | cbbe79a | 2010-05-24 10:44:35 -0400 | [diff] [blame] | 303 | void unregister_all_tcp_transports(); |
Mike Lockwood | 74d7ff8 | 2009-10-11 23:04:18 -0400 | [diff] [blame] | 304 | |
Scott Anderson | e109d26 | 2012-04-20 11:21:14 -0700 | [diff] [blame] | 305 | void register_usb_transport(usb_handle *h, const char *serial, const char *devpath, unsigned writeable); |
Mike Lockwood | 95b837d | 2009-08-08 12:37:44 -0400 | [diff] [blame] | 306 | |
| 307 | /* this should only be used for transports with connection_state == CS_NOPERM */ |
| 308 | void unregister_usb_transport(usb_handle *usb); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 309 | |
Mike Lockwood | 74d7ff8 | 2009-10-11 23:04:18 -0400 | [diff] [blame] | 310 | atransport *find_transport(const char *serial); |
Stefan Hilzinger | d9d1ca4 | 2010-04-26 10:17:43 +0100 | [diff] [blame] | 311 | #if ADB_HOST |
| 312 | atransport* find_emulator_transport_by_adb_port(int adb_port); |
| 313 | #endif |
Mike Lockwood | 74d7ff8 | 2009-10-11 23:04:18 -0400 | [diff] [blame] | 314 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 315 | int service_to_fd(const char *name); |
| 316 | #if ADB_HOST |
| 317 | asocket *host_service_to_socket(const char* name, const char *serial); |
| 318 | #endif |
| 319 | |
| 320 | #if !ADB_HOST |
| 321 | int init_jdwp(void); |
| 322 | asocket* create_jdwp_service_socket(); |
| 323 | asocket* create_jdwp_tracker_service_socket(); |
| 324 | int create_jdwp_connection_fd(int jdwp_pid); |
| 325 | #endif |
| 326 | |
David 'Digit' Turner | 2525869 | 2013-03-21 21:07:42 +0100 | [diff] [blame] | 327 | int handle_forward_request(const char* service, transport_type ttype, char* serial, int reply_fd); |
| 328 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 329 | #if !ADB_HOST |
| 330 | void framebuffer_service(int fd, void *cookie); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 331 | void remount_service(int fd, void *cookie); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 332 | #endif |
| 333 | |
| 334 | /* packet allocator */ |
| 335 | apacket *get_apacket(void); |
| 336 | void put_apacket(apacket *p); |
| 337 | |
| 338 | int check_header(apacket *p); |
| 339 | int check_data(apacket *p); |
| 340 | |
leozwang | cbf0267 | 2014-08-15 09:51:27 -0700 | [diff] [blame] | 341 | // Define it if you want to dump packets. |
| 342 | #define DEBUG_PACKETS 0 |
| 343 | |
Benoit Goby | d5fcafa | 2012-04-12 12:23:49 -0700 | [diff] [blame] | 344 | #if !DEBUG_PACKETS |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 345 | #define print_packet(tag,p) do {} while (0) |
| 346 | #endif |
| 347 | |
John Michelau | c318833 | 2010-09-23 17:08:34 -0500 | [diff] [blame] | 348 | #if ADB_HOST_ON_TARGET |
| 349 | /* adb and adbd are coexisting on the target, so use 5038 for adb |
| 350 | * to avoid conflicting with adbd's usage of 5037 |
| 351 | */ |
| 352 | # define DEFAULT_ADB_PORT 5038 |
| 353 | #else |
| 354 | # define DEFAULT_ADB_PORT 5037 |
| 355 | #endif |
| 356 | |
Stefan Hilzinger | a84a42e | 2010-04-19 12:21:12 +0100 | [diff] [blame] | 357 | #define DEFAULT_ADB_LOCAL_TRANSPORT_PORT 5555 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 358 | |
Xavier Ducrohet | a481d09 | 2009-05-21 17:47:43 -0700 | [diff] [blame] | 359 | #define ADB_CLASS 0xff |
| 360 | #define ADB_SUBCLASS 0x42 |
| 361 | #define ADB_PROTOCOL 0x1 |
Dima Zavin | 3fd82b8 | 2009-05-08 18:25:58 -0700 | [diff] [blame] | 362 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 363 | |
Mike Lockwood | cef31a0 | 2009-08-26 12:50:22 -0700 | [diff] [blame] | 364 | void local_init(int port); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 365 | int local_connect(int port); |
Stefan Hilzinger | d9d1ca4 | 2010-04-26 10:17:43 +0100 | [diff] [blame] | 366 | int local_connect_arbitrary_ports(int console_port, int adb_port); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 367 | |
| 368 | /* usb host/client interface */ |
| 369 | void usb_init(); |
| 370 | void usb_cleanup(); |
| 371 | int usb_write(usb_handle *h, const void *data, int len); |
| 372 | int usb_read(usb_handle *h, void *data, int len); |
| 373 | int usb_close(usb_handle *h); |
| 374 | void usb_kick(usb_handle *h); |
| 375 | |
| 376 | /* used for USB device detection */ |
Xavier Ducrohet | a09fbd1 | 2009-05-20 17:33:53 -0700 | [diff] [blame] | 377 | #if ADB_HOST |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 378 | int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_protocol); |
Xavier Ducrohet | a09fbd1 | 2009-05-20 17:33:53 -0700 | [diff] [blame] | 379 | #endif |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 380 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 381 | int adb_commandline(int argc, char **argv); |
| 382 | |
| 383 | int connection_state(atransport *t); |
| 384 | |
| 385 | #define CS_ANY -1 |
| 386 | #define CS_OFFLINE 0 |
| 387 | #define CS_BOOTLOADER 1 |
| 388 | #define CS_DEVICE 2 |
| 389 | #define CS_HOST 3 |
| 390 | #define CS_RECOVERY 4 |
Mike Lockwood | 95b837d | 2009-08-08 12:37:44 -0400 | [diff] [blame] | 391 | #define CS_NOPERM 5 /* Insufficient permissions to communicate with the device */ |
Doug Zongker | 447f061 | 2012-01-09 14:54:53 -0800 | [diff] [blame] | 392 | #define CS_SIDELOAD 6 |
Benoit Goby | 77e8e58 | 2013-01-15 12:36:47 -0800 | [diff] [blame] | 393 | #define CS_UNAUTHORIZED 7 |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 394 | |
| 395 | extern int HOST; |
JP Abgrall | 408fa57 | 2011-03-16 15:57:42 -0700 | [diff] [blame] | 396 | extern int SHELL_EXIT_NOTIFY_FD; |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 397 | |
Jeff Sharkey | 5d9d434 | 2014-05-26 18:30:43 -0700 | [diff] [blame] | 398 | typedef enum { |
| 399 | SUBPROC_PTY = 0, |
| 400 | SUBPROC_RAW = 1, |
| 401 | } subproc_mode; |
| 402 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 403 | #define CHUNK_SIZE (64*1024) |
| 404 | |
Andrzej Pietrasiewicz | fd96db1 | 2012-01-13 15:13:46 +0100 | [diff] [blame] | 405 | #if !ADB_HOST |
| 406 | #define USB_ADB_PATH "/dev/android_adb" |
| 407 | |
| 408 | #define USB_FFS_ADB_PATH "/dev/usb-ffs/adb/" |
| 409 | #define USB_FFS_ADB_EP(x) USB_FFS_ADB_PATH#x |
| 410 | |
| 411 | #define USB_FFS_ADB_EP0 USB_FFS_ADB_EP(ep0) |
| 412 | #define USB_FFS_ADB_OUT USB_FFS_ADB_EP(ep1) |
| 413 | #define USB_FFS_ADB_IN USB_FFS_ADB_EP(ep2) |
| 414 | #endif |
| 415 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 416 | int sendfailmsg(int fd, const char *reason); |
| 417 | int handle_host_request(char *service, transport_type ttype, char* serial, int reply_fd, asocket *s); |
| 418 | |
| 419 | #endif |