"Jacky.S.Mu" <jackyser...@gmail.com> ha scritto:
Hello, Maybe there is misunderstanding for me while reading the code freerunner/froyo/hardware/ril/vchanneld.c when I port it to my current device. static int vch_write_data(struct virtual_channel *vch, char *ptr, int len) { int tmp; struct phy_device *phy = vch->phy; tmp = (len > phy->max_length) ? phy->max_length : len; while (len > 0) { gsm0710_write(vch, GSM0710_DATA, ptr, tmp); // ??????????????????????? ptr += tmp; len -= tmp; } return len;
Yes. It's wrong, post a patch or I will do it. Michael
} I am worried the above line tagged with "???..." by me. In my understanding, the code in the "while" segment is trying to divide the data to fit the max length requirement. e.g. In freerunner froyo the "phy->max_length" is set to 128. So if the data length is greater than 128, it will try to send 128 length of data first and then the problem seems to appear. It still try to send the 128 length of data even it is not achieve to the length. And look at the inside of "gsm0710_write()" and "compute_frame_mux_basic()" this is called by "gsm0710_write()" static int compute_frame_mux_basic(struct virtual_channel *vch, int type, char *src, int len, char *dst) { int hsize, size; int channel = vch->channel; dst[0] = (char)GSM0710_FRAME_FLAG; dst[1] = (char)((channel << 2) | 0x03); dst[2] = (char)type; hsize = size = 4; if (len <= 127) { dst[3] = (char)((len << 1) | 0x01); } else { dst[3] = (char)(len << 1); dst[4] = (char)(len >> 7); hsize++; size++; } if (len > 0) { memcpy(dst + size, src, len); // ??????????????????????????????????? size += len; } dst[size++] = (char)compute_crc((unsigned char *)(dst + 1), hsize - 1); dst[size++] = (char)GSM0710_FRAME_FLAG; return size; } Since the last argument 'len' is not accurate and can be greater than it should be. Is there a chance that it is over the boundary of the 'src', which might results in unexpected consequence? I also would like to know why the max_length is set to 128 rather than 127 in the freerunner froyo because I saw 127 is the boundary of the modem to splite the data. However, my understanding may be wrong. Could anyone correct me or help me to figure it out? (If I post to a wrong place, please tell me.) Thanks Jack.S -- unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting
---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. -- unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting