Index: src/cwc.c =================================================================== --- src/cwc.c (revision 4360) +++ src/cwc.c (working copy) @@ -55,6 +55,7 @@ typedef enum { CARD_IRDETO, CARD_CONAX, + CARD_SECA, CARD_UNKNOWN } card_type_t; @@ -236,6 +237,7 @@ static void cwc_detect_card_type(cwc_t *cwc); void cwc_emm_conax(cwc_t *cwc, uint8_t *data, int len); void cwc_emm_irdeto(cwc_t *cwc, uint8_t *data, int len); +void cwc_emm_seca(cwc_t *cwc, uint8_t *data, int len); /** * @@ -612,6 +614,11 @@ tvhlog(LOG_INFO, "cwc", "%s: conax card", cwc->cwc_hostname); break; + case 0x01: + cwc->cwc_card_type = CARD_SECA; + tvhlog(LOG_INFO, "cwc", "%s: seca card", + cwc->cwc_hostname); + break; default: cwc->cwc_card_type = CARD_UNKNOWN; tvhlog(LOG_INFO, "cwc", "%s: unknown card", @@ -1093,6 +1100,9 @@ case CARD_IRDETO: cwc_emm_irdeto(cwc, data, len); break; + case CARD_SECA: + cwc_emm_seca(cwc, data, len); + break; case CARD_UNKNOWN: break; } @@ -1153,6 +1163,36 @@ /** + * seca emm handler + * inspired by opensasc-ng, https://opensvn.csie.org/traccgi/opensascng/ + */ +void +cwc_emm_seca(cwc_t *cwc, uint8_t *data, int len) +{ + int match = 0; + + if (data[0] == 0x82) { + if (memcmp(&data[3], &cwc->cwc_ua[2], 6) == 0) { + match = 1; + } + } + else if (data[0] == 0x84) { + /* XXX this part is untested but should do no harm */ + int i; + for (i=0; i < cwc->cwc_num_providers; i++) { + if (memcmp(&data[5], &cwc->cwc_providers[i].sa[5], 3) == 0) { + match = 1; + break; + } + } + } + + if (match) + cwc_send_msg(cwc, data, len, 0, 1); +} + + +/** * */ static void