source: trunk/reader-common.h@ 10376

Last change on this file since 10376 was 10376, checked in by gf, 6 years ago

vg2: Add read tiers patch.

For more info see ticket #4091.

Original patch by BigGyros. Original readme follows:

This patch is the sum of various code:

  • some found in streamboard forum (thanks to authors)
  • some were reversed from a (shitty) commercial oscam mods (thanks to an anonymous guy who sent to me) some written just by observing the logs from a season interface

What this patch does?
1) it fix the read of tiers for the nds cards like 09AC that stopped to support

the ins76 method

readtiers = 0 disable

1 ins70

2 ins76

(add it in the reader section or use webif)

2) it adds support for some ins that helps the nds card after the emm update
3) I hope it will breaks business of assholes who gain money from the free
works of some streamboard users.

What this patch does not?
1) this patch does not break any DRM or any countermeasure done to fight the

piracy

2) this patch does not help anybody to share cw
3) this patch does not help the assholes to sell receivers, lines, oscam-mod,

fake solutions, birds, woods, monkeys..

Is the patch tested?

  • Yes, it works..
  • Property svn:eol-style set to LF
File size: 2.8 KB
Line 
1#ifndef READER_COMMON_H_
2#define READER_COMMON_H_
3
4//Warning: OK = 0 and ERROR = 1 in csctapi !!!
5#define SKIPPED 2
6#define OK 1
7#define ERROR 0
8
9#include "csctapi/atr.h"
10#include "oscam-string.h"
11#include "oscam-reader.h"
12
13int32_t reader_cmd2icc(struct s_reader *reader, const uchar *buf, const int32_t l, uchar *response, uint16_t *response_length);
14int32_t card_write(struct s_reader *reader, const uchar *, const uchar *, uchar *, uint16_t *);
15
16#define write_cmd(cmd, data) \
17 { \
18 if (card_write(reader, cmd, data, cta_res, &cta_lr)) return ERROR; \
19 }
20
21#define get_atr \
22 unsigned char atr[ATR_MAX_SIZE]; \
23 uint32_t atr_size; \
24 memset(atr, 0, sizeof(atr)); \
25 ATR_GetRaw(newatr, atr, &atr_size);
26
27#define get_atr2 \
28 unsigned char atr2[ATR_MAX_SIZE]; \
29 uint32_t atr_size2; \
30 memset(atr2, 0, sizeof(atr2)); \
31 ATR_GetRaw(newatr, atr2, &atr_size2);
32
33#define get_hist \
34 unsigned char hist[ATR_MAX_HISTORICAL]; \
35 uint32_t hist_size = 0; \
36 ATR_GetHistoricalBytes(newatr, hist, &hist_size);
37
38#define def_resp \
39 unsigned char cta_res[CTA_RES_LEN]; \
40 memset(cta_res, 0, CTA_RES_LEN); \
41 uint16_t cta_lr;
42
43#ifdef WITH_CARDREADER
44void cardreader_init_locks(void);
45bool cardreader_init(struct s_reader *reader);
46void cardreader_close(struct s_reader *reader);
47void cardreader_do_reset(struct s_reader *reader);
48void cardreader_reset(struct s_client *cl);
49int32_t cardreader_do_checkhealth(struct s_reader *reader);
50void cardreader_checkhealth(struct s_client *cl, struct s_reader *rdr);
51int32_t cardreader_do_emm(struct s_reader *reader, EMM_PACKET *ep);
52void cardreader_process_ecm(struct s_reader *reader, struct s_client *cl, ECM_REQUEST *er);
53void cardreader_get_card_info(struct s_reader *reader);
54void cardreader_poll_status(struct s_reader *reader);
55int32_t check_sct_len(const unsigned char *data, int32_t off);
56#else
57static inline void cardreader_init_locks(void) { }
58static inline bool cardreader_init(struct s_reader *UNUSED(reader))
59{
60 return true;
61}
62static inline void cardreader_close(struct s_reader *UNUSED(reader)) { }
63static inline void cardreader_do_reset(struct s_reader *UNUSED(reader))
64{
65 return;
66}
67static inline void cardreader_reset(struct s_client *UNUSED(cl)) { }
68static inline int32_t cardreader_do_checkhealth(struct s_reader *UNUSED(reader))
69{
70 return false;
71}
72static inline void cardreader_checkhealth(struct s_client *UNUSED(cl), struct s_reader *UNUSED(rdr)) { }
73static inline int32_t cardreader_do_emm(struct s_reader *UNUSED(reader), EMM_PACKET *UNUSED(ep))
74{
75 return 0;
76}
77static inline void cardreader_process_ecm(struct s_reader *UNUSED(reader), struct s_client *UNUSED(cl), ECM_REQUEST *UNUSED(er)) { }
78static inline void cardreader_get_card_info(struct s_reader *UNUSED(reader)) { }
79static inline void cardreader_poll_status(struct s_reader *UNUSED(reader)) { }
80#endif
81
82#endif
Note: See TracBrowser for help on using the repository browser.