capmt: adjust for recent OSCam frame change

Additional byte describing adapter index was
added to the beginning of the frame.
It only affect tvh capmt mode 2.
This commit is contained in:
Mariusz Bialonczyk 2013-12-13 09:16:20 +01:00
parent 6f62adc287
commit 2db7becc5b
2 changed files with 16 additions and 3 deletions

View file

@ -385,7 +385,7 @@ handle_ca0(capmt_t* capmt) {
int *request = NULL;
ca_descr_t *ca;
ca_pid_t *cpd;
int process_key, process_next, cai;
int process_key, process_next, cai = 0;
int i, j;
int recvsock = 0;
@ -422,6 +422,18 @@ handle_ca0(capmt_t* capmt) {
else
recvsock = capmt->capmt_sock_ca0[i];
if (recvsock > 0) {
if (capmt->capmt_oscam == 2)
{
// adapter index is in first byte
uint8_t adapter_index;
ret = recv(recvsock, &adapter_index, 1, MSG_DONTWAIT);
if (ret < 0)
{
usleep(10 * 1000);
continue;
}
cai = adapter_index;
}
request = NULL;
ret = recv(recvsock, buffer, (capmt->capmt_oscam == 2) ? sizeof(int) : bufsize, MSG_DONTWAIT);
if (ret > 0) {
@ -481,7 +493,8 @@ handle_ca0(capmt_t* capmt) {
if (capmt->capmt_oscam) {
if (!request)
continue;
cai = i;
if (capmt->capmt_oscam != 2) //in mode 2 we read it directly from socket
cai = i;
if (*request == CA_SET_PID) {
cpd = (ca_pid_t *)&buffer[sizeof(int)];
tvhlog(LOG_DEBUG, "capmt", "CA_SET_PID cai %d req %d (%d %04x)", cai, *request, cpd->index, cpd->pid);

View file

@ -25,7 +25,7 @@ tvheadend.capmteditor = function() {
fields: ['res','name'],
id: 0,
data: [
['2','Recent OSCam (svn rev >= 9063)'],
['2','Recent OSCam (svn rev >= 9095)'],
['1','Older OSCam'],
['0','Wrapper (capmt_ca.so)']
]