Android-x86
Fork
Spenden

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-ril: Commit

hardware/ril


Commit MetaInfo

Revisionb499fabc3459930a42f0ecc62257caef6aa216dc (tree)
Zeit2010-03-04 19:00:32
AutorLuke Yang <luke_yang@asus...>
CommiterChih-Wei Huang

Log Message

modify reference-ril to support 3G modem card on x86

Ändern Zusammenfassung

Diff

--- a/reference-ril/atchannel.c
+++ b/reference-ril/atchannel.c
@@ -208,6 +208,8 @@ static const char * s_smsUnsoliciteds[] = {
208208 "+CMT:",
209209 "+CDS:",
210210 "+CBM:"
211+ //,"+CMGR"
212+ //,"+CMTI"
211213 };
212214 static int isSMSUnsolicited(const char *line)
213215 {
--- a/reference-ril/reference-ril.c
+++ b/reference-ril/reference-ril.c
@@ -36,11 +36,12 @@
3636
3737 #define LOG_TAG "RIL"
3838 #include <utils/Log.h>
39+#include <cutils/properties.h>
3940
4041 #define MAX_AT_RESPONSE 0x1000
4142
4243 /* pathname returned from RIL_REQUEST_SETUP_DATA_CALL / RIL_REQUEST_SETUP_DEFAULT_PDP */
43-#define PPP_TTY_PATH "/dev/omap_csmi_tty1"
44+#define PPP_TTY_PATH "/dev/ppp0"
4445
4546 #ifdef USE_TI_COMMANDS
4647
@@ -239,7 +240,8 @@ static void onSIMReady()
239240 * ds = 1 // Status reports routed to TE
240241 * bfr = 1 // flush buffer
241242 */
242- at_send_command("AT+CNMI=1,2,2,1,1", NULL);
243+ LOGI ("######### SIM READY !!\n");
244+ at_send_command("AT+CNMI=1,2,2,1,0", NULL);
243245 }
244246
245247 static void requestRadioPower(void *data, size_t datalen, RIL_Token t)
@@ -987,18 +989,18 @@ static void requestSetupDataCall(void *data, size_t datalen, RIL_Token t)
987989 len = strlen(cmd);
988990
989991 while (cur < len) {
990- do {
992+ do {
991993 written = write (fd, cmd + cur, len - cur);
992994 } while (written < 0 && errno == EINTR);
993995
994996 if (written < 0) {
995- LOGE("### ERROR writing to /dev/qmi");
996- close(fd);
997- goto error;
998- }
997+ LOGE("### ERROR writing to /dev/qmi");
998+ close(fd);
999+ goto error;
1000+ }
9991001
1000- cur += written;
1001- }
1002+ cur += written;
1003+ }
10021004
10031005 // wait for interface to come online
10041006
@@ -1022,8 +1024,8 @@ static void requestSetupDataCall(void *data, size_t datalen, RIL_Token t)
10221024
10231025 if (retry == 0) {
10241026 LOGE("### Failed to get data connection up\n");
1025- goto error;
1026- }
1027+ goto error;
1028+ }
10271029
10281030 qmistatus = system("netcfg rmnet0 dhcp");
10291031
@@ -1031,31 +1033,41 @@ static void requestSetupDataCall(void *data, size_t datalen, RIL_Token t)
10311033
10321034 if (qmistatus < 0) goto error;
10331035
1034- } else {
1036+ } else {
10351037
1036- asprintf(&cmd, "AT+CGDCONT=1,\"IP\",\"%s\",,0,0", apn);
1038+ //asprintf(&cmd, "AT+CGDCONT=1,\"IP\",\"%s\",,0,0", apn);
10371039 //FIXME check for error here
1038- err = at_send_command(cmd, NULL);
1039- free(cmd);
1040+ //err = at_send_command(cmd, NULL);
1041+ //free(cmd);
10401042
10411043 // Set required QoS params to default
1042- err = at_send_command("AT+CGQREQ=1", NULL);
1044+ //err = at_send_command("AT+CGQREQ=1", NULL);
10431045
10441046 // Set minimum QoS params to default
1045- err = at_send_command("AT+CGQMIN=1", NULL);
1047+ //err = at_send_command("AT+CGQMIN=1", NULL);
10461048
10471049 // packet-domain event reporting
1048- err = at_send_command("AT+CGEREP=1,0", NULL);
1050+ //err = at_send_command("AT+CGEREP=1,0", NULL);
10491051
10501052 // Hangup anything that's happening there now
1051- err = at_send_command("AT+CGACT=1,0", NULL);
1053+ //err = at_send_command("AT+CGACT=1,0", NULL);
1054+ //err = at_send_command("AT+CGACT=1,1", NULL);
10521055
10531056 // Start data on PDP context 1
1054- err = at_send_command("ATD*99***1#", &p_response);
1055-
1056- if (err < 0 || p_response->success == 0) {
1057+ //err = at_send_command("ATD*99***1#", &p_response);
1058+ //err = at_send_command("ATD*99#", &p_response);
1059+ //system("echo test");
1060+ //system("pppd call gprs");
1061+ //property_set("ctl.start", "pppd_gprs");
1062+ //LOGD("ctrl.start err = %d\n", err);
1063+ //err = system("pppd call gprs");
1064+ //LOGD("pppd err = %d\n", err);
1065+ /*if (err < 0 || p_response->success == 0) {
10571066 goto error;
1058- }
1067+ }*/
1068+ // add pppd init code under this line
1069+
1070+
10591071 }
10601072
10611073 RIL_onRequestComplete(t, RIL_E_SUCCESS, response, sizeof(response));
@@ -1836,9 +1848,6 @@ static void initializeCallback(void *param)
18361848 /* Alternating voice/data off */
18371849 at_send_command("AT+CMOD=0", NULL);
18381850
1839- /* Not muted */
1840- at_send_command("AT+CMUT=0", NULL);
1841-
18421851 /* +CSSU unsolicited supp service notifications */
18431852 at_send_command("AT+CSSN=0,1", NULL);
18441853
@@ -1893,7 +1902,7 @@ static void onUnsolicited (const char *s, const char *sms_pdu)
18931902 {
18941903 char *line = NULL;
18951904 int err;
1896-
1905+LOGI("!!!!!!!!!!!!!!!!!!!!!! reference-ril.c onUnsolicited !!!!!!!!!!!!!!!!!!!!!!1\n");
18971906 /* Ignore unsolicited responses until we're initialized.
18981907 * This is OK because the RIL library will poll for initial state
18991908 */
@@ -2031,7 +2040,7 @@ mainLoop(void *param)
20312040 SOCK_STREAM );
20322041 } else if (s_device_path != NULL) {
20332042 fd = open (s_device_path, O_RDWR);
2034- if ( fd >= 0 && !memcmp( s_device_path, "/dev/ttyS", 9 ) ) {
2043+ if ( fd >= 0) {
20352044 /* disable echo on serial ports */
20362045 struct termios ios;
20372046 tcgetattr( fd, &ios );
@@ -2047,6 +2056,50 @@ mainLoop(void *param)
20472056 }
20482057 }
20492058
2059+#if 0
2060+ fd=-1;
2061+ while (fd < 0) {
2062+ LOGI ("xp-debug mainLoop\n");
2063+ // signal(SIGIO, SIG_IGN); // the important one.
2064+
2065+ fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY);
2066+ LOGD ("##############open /dev/ttyUSB0##############\n");
2067+ if (fd < 0) {
2068+ LOGI ("fd < 0 fd:%d\n",fd);
2069+ //return 0;
2070+ } else {
2071+ fcntl(fd,F_SETFL,0);
2072+ struct termios my_termios;
2073+ tcgetattr(fd, &my_termios);
2074+
2075+ cfsetispeed(&my_termios,B9600); // Baud rate 9600
2076+ cfsetospeed(&my_termios,B9600);
2077+
2078+ my_termios.c_cflag &= ~CSIZE; // 8 data bits
2079+ my_termios.c_cflag &= ~PARENB; // no parity
2080+ my_termios.c_cflag &= ~CSTOPB; // No hw flow control
2081+ my_termios.c_cflag &= ~CRTSCTS;
2082+ my_termios.c_cflag |= CS8;
2083+ my_termios.c_lflag &= ~(ICANON|ECHO|ECHOE|ISIG); // No terminal processing
2084+ my_termios.c_oflag &= ~OPOST;
2085+
2086+ my_termios.c_cc[VMIN] = 0; // Timeout before packet (unused)
2087+ my_termios.c_cc[VTIME] = 10; // Timeout between characters
2088+ my_termios.c_iflag &= ~(IXON|IXOFF|IXANY); // Disable sw flow control
2089+
2090+ my_termios.c_cflag |= (CLOCAL|CREAD);
2091+
2092+ tcsetattr(fd,TCSANOW, &my_termios);
2093+ fcntl(fd,F_SETFL,0);
2094+ }
2095+ if (fd < 0) {
2096+ perror ("opening AT interface. retrying...");
2097+ sleep(10);
2098+ /* never returns */
2099+ }
2100+ }
2101+#endif
2102+
20502103 s_closed = 0;
20512104 ret = at_open(fd, onUnsolicited);
20522105
--- a/rild/rild.c
+++ b/rild/rild.c
@@ -131,8 +131,8 @@ int main(int argc, char **argv)
131131 }
132132 }
133133
134+#if 0
134135 /* special override when in the emulator */
135-#if 1
136136 {
137137 static char* arg_overrides[3];
138138 static char arg_device[32];
Show on old repository browser