Index: /titan/titan/ca.h
===================================================================
--- /titan/titan/ca.h	(revision 27569)
+++ /titan/titan/ca.h	(revision 27570)
@@ -160,5 +160,8 @@
 		return 1;
 	}
-
+	
+#ifdef MIPSEL
+	memcpy(tmpbuf, buf, len);
+#else
 	// should we send a data last ?
 	if(buf != NULL)
@@ -192,5 +195,23 @@
 		flag = 1;
 	}
-
+#endif
+
+	if(debug_level == 620)
+	{
+		int i = 0;
+		printf("CA casend to queue (slot %d fd %d): > ", dvbnode->devnr, dvbnode->fd);
+		for(i = 0; i < len; i++)
+			printf("%02x ", tmpbuf[i]);
+		printf("\n");
+	}
+	
+#ifdef MIPSEL
+	int ret = cawrite(dvbnode, dvbnode->fd, tmpbuf, len, flag, -1);
+	if(ret < 0 || ret != len)
+	{
+		err("writing data to queue, slot %d", dvbnode->devnr);
+		return 1; //error
+	}
+#else
 	struct queue* qe = addqueue(dvbnode->devnr, tmpbuf, len, NULL, 0, flag, NULL);
 	free(tmpbuf); tmpbuf = NULL;
@@ -200,4 +221,5 @@
 		return 1; //error
 	}
+#endif
 
 	return 0; //ready
@@ -547,5 +569,5 @@
 					
 					addmenulistall(&mlist, tmpstr1, NULL, 0, NULL);
-					mbox = menulistbox(mlist, "cimenulist", tmpstr, NULL, NULL, 1, 0);
+					mbox = menulistbox(mlist, "menulist", tmpstr, NULL, NULL, 1, 0);
 					if(mbox == NULL) //exit
 						cammistop(dvbnode, sessionnr);
@@ -1072,5 +1094,5 @@
 
 	for(sessionnr = 1; sessionnr < MAXCASESSION; ++sessionnr)
-        {
+	{
 		if(casession[sessionnr].inuse > 0)
 		{
@@ -1484,4 +1506,11 @@
 				cawrite(dvbnode, dvbnode->fd, sendbuf, 5, 0, -1);
 			}
+			break;
+		}
+		case 0x13: //MIPSEL
+		{
+			debug(620, "got mipsel session data (slot %d, conn %d)", dvbnode->devnr, canode->connid);
+			casessionreceive(dvbnode, buf, asnlen);
+			casessionpoll(dvbnode);
 			break;
 		}
@@ -1559,4 +1588,9 @@
 			{
 				//debug(620, "read, slot %d, ret %d", dvbnode->devnr, ret);
+#ifdef MIPSEL
+				canode->poll = 1;
+				canode->connid = dvbnode->devnr + 1;
+				processtpdu(dvbnode, 0x13, buf, len);
+#else
 				tmpbuf = buf;
 				int buflen = len - 2;
@@ -1587,13 +1621,40 @@
 					tmpbuf += asnlen;
 					buflen -= asnlen;
-
-				}
+				}
+#endif
 			}
 			else if(ret == 1 && canode->poll == 1) //write
 			{
+#ifdef MIPSEL
+				int count = 0;
 				struct queue* qe = getqueue(dvbnode->devnr);
 				if(qe != NULL)
 				{
+					while(qe != NULL && count < 10)
+					{
+						//debug(620, "write (queue), slot %d, ret %d", dvbnode->devnr, ret);
+						
+						int writeret = cawrite(dvbnode, dvbnode->fd, qe->data, qe->len, qe->flag, -1);
+						if(writeret >= 0 && writeret == qe->len)
+						{
+							delqueue(qe, 0);
+							qe = getqueue(dvbnode->devnr);
+						}
+						else
+							count++;
+					}
+				}
+				else
+				{
+					//debug(620, "write (poll), slot %d, ret %d", dvbnode->devnr, ret);
+					casend(dvbnode, NULL, 0);
+					if(canode->fastrun > 0) canode->fastrun--;
+				}
+#else			
+				struct queue* qe = getqueue(dvbnode->devnr);
+				if(qe != NULL)
+				{
 					//debug(620, "write (queue), slot %d, ret %d", dvbnode->devnr, ret);
+					
 					int writeret = cawrite(dvbnode, dvbnode->fd, qe->data, qe->len, qe->flag, -1);
 					if(writeret >= 0 && writeret == qe->len)
@@ -1608,4 +1669,5 @@
 					if(canode->fastrun > 0) canode->fastrun--;
 				}
+#endif
 			}
 			else if(ret == 1 && canode->poll == 0)
Index: /titan/titan/mipselport.h
===================================================================
--- /titan/titan/mipselport.h	(revision 27569)
+++ /titan/titan/mipselport.h	(revision 27570)
@@ -982,9 +982,9 @@
 	
 	fds.fd = node->fd;
-	fds.events = POLLPRI | POLLIN;
+	fds.events = POLLOUT | POLLPRI | POLLIN;
 	
 	info->flags = 0;
 	
-	ret = TEMP_FAILURE_RETRY(poll(&fds, 1, 300));
+	ret = TEMP_FAILURE_RETRY(poll(&fds, 1, 1000));
 	
 	if(ret < 0)
@@ -997,8 +997,10 @@
 	else if(ret > 0)
 	{
+		if(fds.revents & POLLOUT)
+			info->flags = CA_CI_MODULE_READY;
 		if(fds.revents & POLLIN)
+			info->flags = CA_CI_MODULE_READY;
+		if(fds.revents & POLLPRI)
 			info->flags = 0;
-		if(fds.revents & POLLPRI)
-			info->flags = CA_CI_MODULE_READY;
 	}
 
