aboutsummaryrefslogtreecommitdiffstats
path: root/android/qemud.h
blob: 4fa71d0526c8c721084bd5988b4e39ae4d1259f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* Copyright (C) 2007-2008 The Android Open Source Project
**
** This software is licensed under the terms of the GNU General Public
** License version 2, as published by the Free Software Foundation, and
** may be copied, distributed, and modified under those terms.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
*/
#ifndef _android_qemud_h
#define _android_qemud_h

#include "qemu-common.h"

/* recent versions of the emulated Android system contains a background
 * daemon, named 'qemud', which runs as root and opens /dev/ttyS0
 *
 * its purpose is to multiplex several communication channels between
 * the emulator and the system through a single serial port.
 *
 * each channel will be connected to a qemud-created unix socket on the
 * system, and to either a emulated character device or other facility in
 * the emulator.
 *
 *                                                       +--------> /dev/socket/qemud_gsm
 *   emulated GSM    <-----+                       ______|_
 *                         |        emulated      |        |
 *                         +====> /dev/ttyS0 <===>| qemud  |------> /dev/socket/qemud_gps
 *                         |                      |________|
 *   emulated GPS    <-----+                            |
 *                         |                            +---------> other
 *                         |
 *   other  <--------------+
 *
 *
 *   this is done to overcome specific permission problems, as well as to add various
 *   features that would require special kernel drivers otherwise even though they
 *   only need a simple character channel.
 */

/* initialize the qemud support code in the emulator
 */

extern void  android_qemud_init( void );

/* return the character driver state object that needs to be connected to the
 * emulated serial port where all multiplexed channels go through.
 */
extern CharDriverState*  android_qemud_get_cs( void );

/* return the character driver state corresponding to a named qemud communication
 * channel. this can be used to send/data the channel.
 * returns 0 on success, or -1 in case of error
 */
extern int  android_qemud_get_channel( const char*  name, CharDriverState* *pcs );

/* set the character driver state for a given qemud communication channel. this
 * is used to attach the channel to an external char driver device directly.
 * returns 0 on success, -1 on error
 */
extern int  android_qemud_set_channel( const char*  name, CharDriverState*  peer_cs );

/* list of known qemud channel names */
#define  ANDROID_QEMUD_GSM      "gsm"
#define  ANDROID_QEMUD_GPS      "gps"
#define  ANDROID_QEMUD_CONTROL  "control"

/* add new channel names here when you need them */

#endif /* _android_qemud_h */