diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2010-12-29 15:50:50 -0800 |
---|---|---|
committer | Lorenzo Colitti <lorenzo@google.com> | 2011-01-31 17:07:12 -0800 |
commit | 3b1530aef62476248825a2092c9aea800395c3b1 (patch) | |
tree | 3a671eea54e0b79055ebeac3137f6be53667781f | |
parent | aea7d5beb2d2cc4d49954f9d5158b8a53c3d7d31 (diff) | |
download | android_hardware_ril-3b1530aef62476248825a2092c9aea800395c3b1.tar.gz android_hardware_ril-3b1530aef62476248825a2092c9aea800395c3b1.tar.bz2 android_hardware_ril-3b1530aef62476248825a2092c9aea800395c3b1.zip |
Port RIL v4 to gingerbread from master.
Version 4 is backwards compatible with versions 2 and 3, so
this will not affect passion.
Bug: 3333633
Change-Id: If2e48e9dd37e17e9955563d2cd2cb94ccb2a8efe
-rw-r--r-- | include/telephony/ril.h | 34 | ||||
-rw-r--r-- | libril/ril.cpp | 36 |
2 files changed, 56 insertions, 14 deletions
diff --git a/include/telephony/ril.h b/include/telephony/ril.h index 1cbdfad..d3c7569 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -40,7 +40,7 @@ extern "C" { #endif -#define RIL_VERSION 3 +#define RIL_VERSION 4 #define CDMA_ALPHA_INFO_BUFFER_LENGTH 64 #define CDMA_NUMBER_INFO_BUFFER_LENGTH 81 @@ -157,9 +157,11 @@ typedef struct { typedef struct { int cid; /* Context ID */ int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */ - char * type; /* X.25, IP, IPV6, etc. */ + char * type; /* One of the PDP_type values in TS 27.007 section 10.1.1. + For example, "IP", "IPV6", "IPV4V6", or "PPP". */ char * apn; - char * address; + char * address; /* The IPv4 or IPv6 address assigned to the call, e.g., "192.0.1.3" + or "2001:db8::1". */ } RIL_Data_Call_Response; typedef struct { @@ -1316,17 +1318,24 @@ typedef struct { * 1 => PAP may be performed; CHAP is never performed. * 2 => CHAP may be performed; PAP is never performed. * 3 => PAP / CHAP may be performed - baseband dependent. + * ((const char **)data)[6] is the PDP type to request if the radio technology is GSM/UMTS. + * Must be one of the PDP_type values in TS 27.007 section 10.1.1. + * For example, "IP", "IPV6", "IPV4V6", or "PPP". * * "response" is a char ** - * ((char **)response)[0] indicating PDP CID, which is generated by RIL. This Connection ID is - * used in GSM/UMTS and CDMA - * ((char **)response)[1] indicating the network interface name for GSM/UMTS or CDMA - * ((char **)response)[2] indicating the IP address for this interface for GSM/UMTS - * and NULL for CDMA + * ((char **)response)[0] the Connection ID, CID, which is generated by RIL. + * ((char **)response)[1] the network interface name. + * ((char **)response)[2] a numeric IPv4 or IPv6 address that has been assigned to the interface. + * ((char **)response)[3] a space-separated list of numeric IPv4 or IPv6 DNS addresses. + * Ignored on Android platforms before 3.0 and instead two DNS IP addresses + * are retrieved from system properties "net.$IN.dns1" and "net.$IN.dns2". + * ((char **)response)[4] the numeric IPv4 or IPv6 address of the default gateway. + * Ignored on Android platforms before 3.0 and instead an IP address + * is retrieved from system property "net.$IN.gw". * - * FIXME may need way to configure QoS settings - * - * replaces RIL_REQUEST_SETUP_DEFAULT_PDP + * Notes: + * 1) Numeric addresses must be in the Java InetAddress parsable representation. + * 2) $IN in the above comments is the interface name from response[1]. * * Valid errors: * SUCCESS @@ -1621,6 +1630,9 @@ typedef struct { * * "data" is const char ** * ((char**)data)[0] indicating CID + * ((char**)data)[1] indicating Disconnect Reason + * 0 => No specific reason specified + * 1 => Radio shutdown requested * * "response" is NULL * diff --git a/libril/ril.cpp b/libril/ril.cpp index f31c516..ca19d7c 100644 --- a/libril/ril.cpp +++ b/libril/ril.cpp @@ -201,6 +201,7 @@ static void dispatchSIM_IO (Parcel& p, RequestInfo *pRI); static void dispatchCallForward(Parcel& p, RequestInfo *pRI); static void dispatchRaw(Parcel& p, RequestInfo *pRI); static void dispatchSmsWrite (Parcel &p, RequestInfo *pRI); +static void dispatchDataCall (Parcel& p, RequestInfo *pRI); static void dispatchCdmaSms(Parcel &p, RequestInfo *pRI); static void dispatchCdmaSmsAck(Parcel &p, RequestInfo *pRI); @@ -1179,6 +1180,34 @@ invalid: } +// For backwards compatibility in RIL_REQUEST_SETUP_DATA_CALL. +// Version 4 of the RIL interface adds a new PDP type parameter to support +// IPv6 and dual-stack PDP contexts. When dealing with a previous version of +// RIL, remove the parameter from the request. +static void dispatchDataCall(Parcel& p, RequestInfo *pRI) { + // In RIL v3, REQUEST_SETUP_DATA_CALL takes 6 parameters. + const int numParamsRilV3 = 6; + + // The first bytes of the RIL parcel contain the request number and the + // serial number - see processCommandBuffer(). Copy them over too. + int pos = p.dataPosition(); + + int numParams = p.readInt32(); + if (s_callbacks.version < 4 && numParams > numParamsRilV3) { + Parcel p2; + p2.appendFrom(&p, 0, pos); + p2.writeInt32(numParamsRilV3); + for(int i = 0; i < numParamsRilV3; i++) { + p2.writeString16(p.readString16()); + } + p2.setDataPosition(pos); + dispatchStrings(p2, pRI); + } else { + p.setDataPosition(pos); + dispatchStrings(p, pRI); + } +} + static int blockingWrite(int fd, const void *buffer, size_t len) { size_t writeOffset = 0; @@ -2526,14 +2555,15 @@ RIL_register (const RIL_RadioFunctions *callbacks) { int flags; if (callbacks == NULL || ((callbacks->version != RIL_VERSION) - && (callbacks->version != 2))) { // Remove when partners upgrade to version 3 + && (callbacks->version < 2))) { // Remove when partners upgrade to version 3 LOGE( "RIL_register: RIL_RadioFunctions * null or invalid version" " (expected %d)", RIL_VERSION); return; } - if (callbacks->version < 3) { - LOGE ("RIL_register: upgrade RIL to version 3 current version=%d", callbacks->version); + if (callbacks->version < RIL_VERSION) { + LOGE ("RIL_register: upgrade RIL to version %d current version=%d", + RIL_VERSION, callbacks->version); } if (s_registerCalled > 0) { |