aboutsummaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-01-09 17:51:21 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-01-09 17:51:21 -0800
commitc2db2b6accc7888df514261a7240e7759df95a4c (patch)
tree0d7ecd37a534c15348cbad01d0d1f84183b7b4d8 /telephony
parentdf7881f07f53b041dc0568be8528e9dbb74994cc (diff)
downloadexternal_qemu-c2db2b6accc7888df514261a7240e7759df95a4c.zip
external_qemu-c2db2b6accc7888df514261a7240e7759df95a4c.tar.gz
external_qemu-c2db2b6accc7888df514261a7240e7759df95a4c.tar.bz2
auto import from //branches/cupcake/...@125939
Diffstat (limited to 'telephony')
-rw-r--r--telephony/gsm.c9
-rw-r--r--telephony/remote_call.c8
-rw-r--r--telephony/sim_card.c15
-rw-r--r--telephony/sysdeps_qemu.c30
4 files changed, 31 insertions, 31 deletions
diff --git a/telephony/gsm.c b/telephony/gsm.c
index 89ff79e..b55578d 100644
--- a/telephony/gsm.c
+++ b/telephony/gsm.c
@@ -35,7 +35,7 @@ gsm_int_from_bcdi( byte_t val )
return ret;
}
-
+#if 0
static int
gsm_bcdi_to_ascii( cbytes_t bcd, int bcdlen, bytes_t dst )
{
@@ -63,8 +63,9 @@ gsm_bcdi_to_ascii( cbytes_t bcd, int bcdlen, bytes_t dst )
}
return result;
}
+#endif
-
+#if 0
static int
gsm_bcdi_from_ascii( cbytes_t ascii, int asciilen, bytes_t dst )
{
@@ -101,7 +102,7 @@ gsm_bcdi_from_ascii( cbytes_t ascii, int asciilen, bytes_t dst )
}
return result;
}
-
+#endif
int
gsm_hexchar_to_int( char c )
@@ -1129,6 +1130,7 @@ sim_adn_alpha_to_utf8( cbytes_t alpha, cbytes_t end, bytes_t dst )
return result;
}
+#if 0
static int
sim_adn_alpha_from_utf8( cbytes_t utf8, int utf8len, bytes_t dst )
{
@@ -1146,6 +1148,7 @@ sim_adn_alpha_from_utf8( cbytes_t utf8, int utf8len, bytes_t dst )
}
return result;
}
+#endif
int
sim_adn_record_from_bytes( SimAdnRecord rec, cbytes_t data, int len )
diff --git a/telephony/remote_call.c b/telephony/remote_call.c
index d5b58eb..2bd5fa8 100644
--- a/telephony/remote_call.c
+++ b/telephony/remote_call.c
@@ -269,7 +269,7 @@ remote_call_event( void* opaque, int events )
int n = sys_channel_read( call->channel, temp, sizeof(temp) );
if (n <= 0) {
/* remote emulator probably quitted */
- //S("%s: emulator %d quitted with %d: %s\n", __FUNCTION__, call->to_port, socket_errno, socket_errstr());
+ //S("%s: emulator %d quitted with %d: %s\n", __FUNCTION__, call->to_port, errno, errno_str);
remote_call_free( call );
return;
}
@@ -305,7 +305,7 @@ remote_call_event( void* opaque, int events )
if (n <= 0) {
/* remote emulator probably quitted */
S("%s: emulator %d quitted unexpectedly with error %d: %s\n",
- __FUNCTION__, call->to_port, socket_errno, socket_errstr());
+ __FUNCTION__, call->to_port, errno, errno_str);
if (call->result_func)
call->result_func( call->result_opaque, 0 );
remote_call_free( call );
@@ -334,7 +334,7 @@ remote_call_event( void* opaque, int events )
static RemoteCall _the_remote_calls;
-
+#if 0
static int
remote_from_number( const char* from )
{
@@ -349,7 +349,7 @@ remote_from_number( const char* from )
return (int) num;
}
-
+#endif
static RemoteCall
remote_call_generic( RemoteCallType type, const char* to_number, int from_port )
diff --git a/telephony/sim_card.c b/telephony/sim_card.c
index 9e48200..a5a3249 100644
--- a/telephony/sim_card.c
+++ b/telephony/sim_card.c
@@ -13,6 +13,11 @@
#include <string.h>
#include <assert.h>
+/* set ENABLE_DYNAMIC_RECORDS to 1 to enable dynamic records
+ * for now, this is an experimental feature that needs more testing
+ */
+#define ENABLE_DYNAMIC_RECORDS 0
+
#define A_SIM_PIN_SIZE 4
#define A_SIM_PUK_SIZE 8
@@ -180,6 +185,7 @@ typedef union {
} SimFileRec, *SimFile;
+#if ENABLE_DYNAMIC_RECORDS
/* convert a SIM File descriptor into an ASCII string,
assumes 'dst' is NULL or properly sized.
return the number of chars, or -1 on error */
@@ -196,7 +202,7 @@ sim_file_to_hex( SimFile file, bytes_t dst )
case SIM_FILE_EF_CYCLIC:
{
if (dst) {
- int file_size, file_type, perm;
+ int file_size, perm;
memcpy(dst, "0000", 4); /* bytes 1-2 are RFU */
dst += 4;
@@ -311,14 +317,15 @@ static SimFileEFDedicatedRec _const_files_dedicated[] =
{ 0, 0, 0, NULL, 0 } /* end of list */
};
-
+#endif /* ENABLE_DYNAMIC_RECORDS */
const char*
asimcard_io( ASimCard sim, const char* cmd )
{
int nn;
+#if ENABLE_DYNAMIC_RECORDS
int command, id, p1, p2, p3;
-
+#endif
static const struct { const char* cmd; const char* answer; } answers[] =
{
{ "+CRSM=192,28436,0,0,15", "+CRSM: 144,0,000000146f1404001aa0aa01020000" },
@@ -365,7 +372,7 @@ asimcard_io( ASimCard sim, const char* cmd )
assert( memcmp( cmd, "+CRSM=", 6 ) == 0 );
-#if 0 /* this code officially disabled in the depot until properly tested and debugged */
+#if ENABLE_DYNAMIC_RECORDS
if ( sscanf(cmd, "+CRSM=%d,%d,%d,%d,%d", &command, &id, &p1, &p2, &p3) == 5 ) {
switch (command) {
case A_SIM_CMD_GET_RESPONSE:
diff --git a/telephony/sysdeps_qemu.c b/telephony/sysdeps_qemu.c
index 469e0fe..39d966e 100644
--- a/telephony/sysdeps_qemu.c
+++ b/telephony/sysdeps_qemu.c
@@ -12,16 +12,6 @@
#include "sockets.h"
#include "sysdeps.h"
#include "vl.h"
-#ifdef _WIN32
-#include <winsock2.h>
-#else
-#include <sys/socket.h>
-#include <sys/select.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <netdb.h>
-#endif
#define DEBUG 1
@@ -243,14 +233,14 @@ sys_channel_read( SysChannel channel, void* buffer, int size )
char* buf = (char*) buffer;
while (len > 0) {
- int ret = recv(channel->fd, buf, len, 0);
+ int ret = socket_recv(channel->fd, buf, len);
if (ret < 0) {
- if (socket_errno == EINTR)
+ if (errno == EINTR)
continue;
- if (socket_errno == EWOULDBLOCK)
+ if (errno == EWOULDBLOCK)
break;
D( "%s: after reading %d bytes, recv() returned error %d: %s\n",
- __FUNCTION__, size - len, socket_errno, socket_errstr());
+ __FUNCTION__, size - len, errno, errno_str);
return -1;
} else if (ret == 0) {
break;
@@ -270,14 +260,14 @@ sys_channel_write( SysChannel channel, const void* buffer, int size )
const char* buf = (const char*) buffer;
while (len > 0) {
- int ret = send(channel->fd, buf, len, 0);
+ int ret = socket_send(channel->fd, buf, len);
if (ret < 0) {
- if (socket_errno == EINTR)
+ if (errno == EINTR)
continue;
- if (socket_errno == EWOULDBLOCK)
+ if (errno == EWOULDBLOCK)
break;
D( "%s: send() returned error %d: %s\n",
- __FUNCTION__, socket_errno, socket_errstr());
+ __FUNCTION__, errno, errno_str);
return -1;
} else if (ret == 0) {
break;
@@ -316,7 +306,7 @@ sys_channel_create_tcp_server( int port )
{
SysChannel channel = sys_channel_alloc();
- channel->fd = socket_anyaddr_server( port, SOCK_STREAM );
+ channel->fd = socket_anyaddr_server( port, SOCKET_STREAM );
if (channel->fd < 0) {
D( "%s: failed to created network socket on TCP:%d\n",
__FUNCTION__, port );
@@ -361,7 +351,7 @@ sys_channel_create_tcp_client( const char* hostname, int port )
{
SysChannel channel = sys_channel_alloc();
- channel->fd = socket_network_client( hostname, port, SOCK_STREAM );
+ channel->fd = socket_network_client( hostname, port, SOCKET_STREAM );
if (channel->fd < 0) {
sys_channel_free(channel);
return NULL;