Changeset 1271
- Timestamp:
- 01/17/10 20:38:50 (13 years ago)
- Location:
- branches/smartreader
- Files:
-
- 2 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/smartreader/csctapi/Makefile
r1225 r1271 13 13 $(LIBFILE1)(ctapi.o) \ 14 14 $(LIBFILE1)(icc_async.o) \ 15 $(LIBFILE1)(ifd_towitoko.o) \16 15 $(LIBFILE1)(ifd_cool.o) \ 17 16 $(LIBFILE1)(ifd_sci.o) \ -
branches/smartreader/csctapi/ct_slot.c
r1255 r1271 25 25 #include "defines.h" 26 26 #include "ct_slot.h" 27 #include "ifd_towitoko.h"28 27 #include "icc_async.h" 29 28 #include "protocol_t0.h" … … 38 37 #endif 39 38 39 /* Card status *///FIXME simplify this + duplicate in icc_async.h 40 #define IFD_TOWITOKO_CARD(status) (((status) & 0x40) == 0x40) 41 #define IFD_TOWITOKO_CHANGE(status) (((status) & 0x80) == 0x80) 42 40 43 /* Try first asynchronous init and if it fails try synchronous */ 41 44 //#undef ICC_PROBE_ASYNC_FIRST … … 66 69 char CT_Slot_Init (CT_Slot * slot, int sn) 67 70 { 68 slot->ifd = IFD_Towitoko_New(); 69 70 if (slot->ifd == NULL) 71 return ERR_MEMORY; 72 73 if (IFD_Towitoko_Init (slot->ifd, sn) != IFD_TOWITOKO_OK) 74 { 75 IFD_Towitoko_Delete (slot->ifd); 76 slot->ifd = NULL; 71 if (!Phoenix_Init()) 77 72 return ERR_TRANS; 78 }79 73 80 74 return OK; … … 133 127 return ERR_MEMORY; 134 128 135 if (ICC_Async_Init (slot->icc , slot->ifd) != ICC_ASYNC_OK)129 if (ICC_Async_Init (slot->icc) != ICC_ASYNC_OK) 136 130 { 137 131 ICC_Async_Delete (slot->icc); … … 303 297 bool CT_Slot_IsLast (CT_Slot * slot) 304 298 { 305 return (IFD_Towitoko_GetSlot(slot->ifd) >= IFD_Towitoko_GetNumSlots()-1); 299 //return (IFD_Towitoko_GetSlot(slot->ifd) >= IFD_Towitoko_GetNumSlots()-1); 300 return 1; //GetSlot always returns 0, and GetNumSlots returns always 1 306 301 } 307 302 308 303 void CT_Slot_GetType (CT_Slot * slot, BYTE * buffer, int len) 309 304 { 310 IFD_Towitoko_GetDescription (slot->ifd, buffer, len); 305 //IFD_Towitoko_GetDescription (slot->ifd, buffer, len) 306 buffer="dummy"; 307 len=5; 311 308 } 312 309 … … 347 344 } 348 345 349 if (slot->ifd != NULL) 350 { 351 if (IFD_Towitoko_Close (slot->ifd) != IFD_TOWITOKO_OK) 352 ret = ERR_TRANS; 353 354 IFD_Towitoko_Delete (slot->ifd); 355 } 346 if (!Phoenix_Close ()) 347 ret = ERR_TRANS; 356 348 357 349 CT_Slot_Clear (slot); … … 371 363 static void CT_Slot_Clear (CT_Slot * slot) 372 364 { 373 slot->ifd = NULL;374 365 slot->icc = NULL; 375 366 slot->protocol = NULL; -
branches/smartreader/csctapi/ct_slot.h
r1255 r1271 31 31 #include "ctapi.h" 32 32 #include "ctbcs.h" 33 #include "ifd_towitoko.h"34 33 35 34 … … 53 52 typedef struct 54 53 { 55 IFD * ifd; /* Interface device */56 54 void * icc; /* Integrated circuit card */ 57 55 void * protocol; /* Protocol handler */ -
branches/smartreader/csctapi/ctapi.c
r1255 r1271 115 115 116 116 #ifdef DEBUG_CTAPI 117 printf ("CTAPI: CT_init(ctn=%u , pn=%u)=%d\n", ctn, pn, ret);117 printf ("CTAPI: CT_init(ctn=%u)=%d\n", ctn, ret); 118 118 #endif 119 119 -
branches/smartreader/csctapi/icc_async.c
r1255 r1271 30 30 #include <string.h> 31 31 #include "ifd.h" 32 #include "mc_global.h" 32 33 33 34 /* … … 73 74 #if defined(SCI_DEV) || defined(COOL) 74 75 if (reader[ridx].typ == R_INTERNAL) 75 #if def SH476 #if defined(SH4) || defined(STB04SCI) 76 77 reader[ridx].handle = open (reader[ridx].device, O_RDWR|O_NONBLOCK|O_NOCTTY); 77 78 #elif COOL … … 120 121 { 121 122 if(!Sci_GetStatus(reader[ridx].handle, &in)) 122 return I FD_TOWITOKO_IO_ERROR;123 return ICC_ASYNC_IFD_ERROR; 123 124 } 124 125 else … … 127 128 { 128 129 if (!Cool_GetStatus(&in)) 129 return I FD_TOWITOKO_IO_ERROR;130 return ICC_ASYNC_IFD_ERROR; 130 131 } 131 132 else … … 147 148 else 148 149 #endif 149 #ifdef USE_GPIO150 if (gpio_detect)151 in=get_gpio();152 else153 #endif154 150 if (!Phoenix_GetStatus(&in)) 155 return I FD_TOWITOKO_IO_ERROR;151 return ICC_ASYNC_IFD_ERROR; 156 152 157 153 if (in) … … 161 157 status[0] = IFD_TOWITOKO_CARD_CHANGE; 162 158 reader[ridx].status = 1; 163 #ifdef USE_GPIO164 if (gpio_detect) set_gpio1(0);165 #endif166 159 } 167 160 else if(reader[ridx].status == 1) … … 173 166 status[0] = IFD_TOWITOKO_CARD_CHANGE; 174 167 reader[ridx].status = 1; 175 #ifdef USE_GPIO176 if (gpio_detect) set_gpio1(0);177 #endif178 168 } 179 169 } … … 184 174 status[0] = IFD_TOWITOKO_NOCARD_CHANGE; 185 175 reader[ridx].status = 2; 186 #ifdef USE_GPIO187 if (gpio_detect) set_gpio1(1);188 #endif189 176 } 190 177 else if(reader[ridx].status == 1) … … 192 179 status[0] = IFD_TOWITOKO_NOCARD_CHANGE; 193 180 reader[ridx].status = 2; 194 #ifdef USE_GPIO195 if (gpio_detect) set_gpio1(1);196 #endif197 181 } 198 182 else … … 209 193 #endif 210 194 211 return I FD_TOWITOKO_OK;212 } 213 214 int ICC_Async_Init (ICC_Async * icc , IFD * ifd)195 return ICC_ASYNC_OK; 196 } 197 198 int ICC_Async_Init (ICC_Async * icc) 215 199 { 216 200 #ifndef ICC_TYPE_SYNC … … 221 205 return ICC_ASYNC_IFD_ERROR; 222 206 207 #ifdef SCI_DEV 223 208 /* Activate ICC */ 224 if ( IFD_Towitoko_ActivateICC (ifd) != IFD_TOWITOKO_OK)209 if (!Sci_Activate()) 225 210 return ICC_ASYNC_IFD_ERROR; 226 211 /* Reset ICC */ 227 #ifdef SCI_DEV228 212 if (reader[ridx].typ == R_INTERNAL) { 229 213 if (!Sci_Reset(&(icc->atr))) … … 278 262 /* Initialize member variables */ 279 263 icc->baudrate = ICC_ASYNC_BAUDRATE; 280 icc->ifd = ifd;281 264 282 265 if (icc->convention == ATR_CONVENTION_INVERSE) … … 435 418 } 436 419 437 IFD * ICC_Async_GetIFD (ICC_Async * icc)438 {439 return icc->ifd;440 }441 442 420 int ICC_Async_Close (ICC_Async * icc) 443 421 { 422 #ifdef SCI_DEV 444 423 /* Dectivate ICC */ 445 if (IFD_Towitoko_DeactivateICC (icc->ifd) != IFD_TOWITOKO_OK) 446 return ICC_ASYNC_IFD_ERROR; 424 if (!Sci_Deactivate()) 425 return ICC_ASYNC_IFD_ERROR; 426 #endif 447 427 448 428 /* Delete atr */ … … 486 466 static void ICC_Async_Clear (ICC_Async * icc) 487 467 { 488 icc->ifd = NULL;489 468 icc->atr = NULL; 490 469 icc->baudrate = 0L; -
branches/smartreader/csctapi/icc_async.h
r1225 r1271 27 27 28 28 #include "defines.h" 29 #include "ifd_towitoko.h" //FIXME30 29 #include "atr.h" 31 30 … … 38 37 #define ICC_ASYNC_IFD_ERROR 1 39 38 #define ICC_ASYNC_ATR_ERROR 2 39 40 /* Card status */ 41 #define IFD_TOWITOKO_NOCARD_NOCHANGE 0x00 42 #define IFD_TOWITOKO_CARD_NOCHANGE 0x40 43 #define IFD_TOWITOKO_NOCARD_CHANGE 0x80 44 #define IFD_TOWITOKO_CARD_CHANGE 0xC0 45 #define IFD_TOWITOKO_CARD(status) (((status) & 0x40) == 0x40) 46 #define IFD_TOWITOKO_CHANGE(status) (((status) & 0x80) == 0x80) 40 47 41 48 /* … … 54 61 typedef struct 55 62 { 56 IFD *ifd; /* Interface device */57 63 ATR *atr; /* Answer to reset of this ICC */ 58 64 int convention; /* Convention of this ICC */ … … 72 78 73 79 /* Initialization and Deactivation */ 74 extern int ICC_Async_Init (ICC_Async * icc , IFD * ifd);80 extern int ICC_Async_Init (ICC_Async * icc); 75 81 extern int ICC_Async_Close (ICC_Async * icc); 76 82 … … 81 87 extern int ICC_Async_GetBaudrate (ICC_Async * icc, unsigned long * baudrate); 82 88 extern ATR *ICC_Async_GetAtr (ICC_Async * icc); 83 extern IFD *ICC_Async_GetIFD (ICC_Async * icc);84 89 extern unsigned long ICC_Async_GetClockRate (); 85 90 -
branches/smartreader/csctapi/ifd.h
r1186 r1271 5 5 6 6 #include "ifd_cool.h" 7 8 typedef struct 9 { 10 unsigned block_delay; /* Delay (ms) after starting to transmit */ 11 unsigned char_delay; /* Delay (ms) after transmiting sucesive chars */ 12 unsigned block_timeout; /* Max timeout (ms) to receive firtst char */ 13 unsigned char_timeout; /* Max timeout (ms) to receive sucesive characters */ 14 } 15 IFD_Timings; //FIXME kill this -
branches/smartreader/csctapi/ifd_phoenix.c
r1255 r1271 10 10 #include "../globals.h" 11 11 #include "atr.h" 12 #include "ifd_towitoko.h" //FIXME13 12 #include <termios.h> 13 #include "ifd.h" //FIXME kill this after IFD timings 14 14 15 15 #define OK 1 … … 18 18 #define IFD_TOWITOKO_MAX_TRANSMIT 255 19 19 #define IFD_TOWITOKO_ATR_TIMEOUT 800 20 #define IFD_TOWITOKO_BAUDRATE 9600 21 22 #ifdef USE_GPIO //felix: definition of gpio functions 23 int gpio_outen,gpio_out,gpio_in; 24 unsigned int pin,gpio; 25 int gpio_detect=0; 26 27 static void set_gpio(int level) 28 { 29 read(gpio_outen, &gpio, sizeof(gpio)); 30 gpio |= pin; 31 write(gpio_outen, &gpio, sizeof(gpio)); 32 33 read(gpio_out, &gpio, sizeof(gpio)); 34 if (level>0) 35 gpio|=pin; 36 else 37 gpio&=~pin; 38 write(gpio_out, &gpio, sizeof(gpio)); 39 } 40 41 static void set_gpio_input(void) 42 { 43 read(gpio_outen, &gpio, sizeof(gpio)); 44 gpio &= ~pin; 45 write(gpio_outen, &gpio, sizeof(gpio)); 46 } 47 48 static int get_gpio(void) 49 { 50 set_gpio_input(); 51 read(gpio_in, &gpio, sizeof(gpio)); 52 return ((int)((gpio&pin)?1:0)); 53 } 54 #endif 55 20 56 21 57 int Phoenix_Init () 22 58 { 59 #ifdef USE_GPIO //felix: define gpio number used for card detect and reset. ref to globals.h 60 extern int oscam_card_detect; 61 if (oscam_card_detect>4) 62 { 63 gpio_detect=oscam_card_detect-4; 64 pin = 1<<gpio_detect; 65 gpio_outen=open("/dev/gpio/outen",O_RDWR); 66 gpio_out=open("/dev/gpio/out",O_RDWR); 67 gpio_in=open("/dev/gpio/in",O_RDWR); 68 set_gpio_input(); 69 } 70 #endif 71 72 #ifdef DEBUG_IFD 73 printf ("IFD: Initializing slot number %d, com=%d\n", slot, reader[ridx].typ); 74 #endif 75 76 if(reader[ridx].typ == R_INTERNAL) //not sure whether this should be moved in front of GPIO part 77 return OK; 78 79 /* Default serial port settings */ 80 if (!IO_Serial_SetParams (IFD_TOWITOKO_BAUDRATE, 8, PARITY_EVEN, 2, IO_SERIAL_HIGH, IO_SERIAL_LOW)) 81 { 82 reader[ridx].status = 0;//added this one because it seemed logical 83 return ERROR; 84 } 85 86 if (!Phoenix_SetBaudrate(IFD_TOWITOKO_BAUDRATE)) 87 { 88 reader[ridx].status = 0; 89 return ERROR; 90 } 91 92 if (!IO_Serial_SetParity (PARITY_EVEN)) 93 { 94 reader[ridx].status = 0; 95 return ERROR; 96 } 97 98 IO_Serial_Flush(); 23 99 return OK; 24 100 } … … 26 102 int Phoenix_GetStatus (int * status) 27 103 { 28 int in; 104 #ifdef USE_GPIO //felix: detect card via defined gpio 105 if (gpio_detect) 106 *status=get_gpio(); 107 else 108 #endif 109 { 29 110 unsigned int modembits=0; 30 111 extern int oscam_card_detect; //FIXME kill global variable … … 33 114 switch(oscam_card_detect&0x7f) 34 115 { 35 case 0: in=(modembits & TIOCM_CAR); break;36 case 1: in=(modembits & TIOCM_DSR); break;37 case 2: in=(modembits & TIOCM_CTS); break;38 case 3: in=(modembits & TIOCM_RNG); break;39 default: in=0; // dummy116 case 0: *status=(modembits & TIOCM_CAR); break; 117 case 1: *status=(modembits & TIOCM_DSR); break; 118 case 2: *status=(modembits & TIOCM_CTS); break; 119 case 3: *status=(modembits & TIOCM_RNG); break; 120 default: *status=0; // dummy 40 121 } 41 122 if (!(oscam_card_detect&0x80)) 42 in=!in;43 *status = in; 44 123 *status=!*status; 124 } 125 return OK; 45 126 } 46 127 … … 70 151 IO_Serial_Ioctl_Lock(1); 71 152 #ifdef USE_GPIO 72 if (gpio_detect) {153 if (gpio_detect) 73 154 set_gpio(0); 74 set_gpio1(0);75 }76 155 else 77 156 #endif … … 82 161 usleep (50000L); 83 162 #endif 84 #ifdef USE_GPIO 163 #ifdef USE_GPIO //felix: set card reset hi (inactive) 85 164 if (gpio_detect) { 86 165 set_gpio_input(); 87 set_gpio1(1);88 166 } 89 167 else … … 101 179 ATR_Delete (*atr); 102 180 (*atr) = NULL; 103 #ifdef USE_GPIO104 if (gpio_detect) set_gpio1(0);105 #endif106 181 } 107 182 } … … 141 216 block_delay = IFD_TOWITOKO_DELAY + timings->block_delay; 142 217 143 #ifdef USE_GPIO144 if (gpio_detect) set_gpio1(0);145 #endif146 218 for (sent = 0; sent < size; sent = sent + to_send) 147 219 { … … 164 236 } 165 237 } 166 #ifdef USE_GPIO167 if (gpio_detect) set_gpio1(1);168 #endif169 238 return OK; 170 239 } … … 182 251 char_timeout = IFD_TOWITOKO_TIMEOUT + timings->char_timeout; 183 252 block_timeout = IFD_TOWITOKO_TIMEOUT + timings->block_timeout; 184 #ifdef USE_GPIO185 if (gpio_detect) set_gpio1(0);186 #endif187 253 if (block_timeout != char_timeout) 188 254 { … … 204 270 return ERROR; 205 271 } 206 #ifdef USE_GPIO207 if (gpio_detect) set_gpio1(1);208 #endif209 272 210 273 #ifdef DEBUG_IFD … … 245 308 return OK; 246 309 } 310 311 int Phoenix_Close () 312 { 313 #ifdef USE_GPIO //felix: close dev if card detected 314 if(gpio_detect) 315 { 316 close(gpio_outen); 317 close(gpio_out); 318 close(gpio_in); 319 } 320 #endif 321 322 #ifdef DEBUG_IFD 323 printf ("IFD: Closing slot\n"); 324 #endif 325 326 reader[ridx].status = 0; 327 return OK; 328 } -
branches/smartreader/csctapi/ifd_sci.c
r1239 r1271 20 20 #include "../globals.h" 21 21 22 #include "ifd_towitoko.h"23 22 #define IFD_TOWITOKO_ATR_TIMEOUT 800 24 23 … … 142 141 } 143 142 144 #endif 143 int Sci_Activate () 144 { 145 #ifdef DEBUG_IFD 146 printf ("IFD: Activating card\n"); 147 #endif 148 #ifdef SCI_DEV 149 if(reader[ridx].typ == R_INTERNAL) 150 { 151 int in; 152 153 #if defined(TUXBOX) && (defined(MIPSEL) || defined(PPC) || defined(SH4)) 154 if(ioctl(reader[ridx].handle, IOCTL_GET_IS_CARD_PRESENT, &in)<0) 155 #else 156 if(ioctl(reader[ridx].handle, IOCTL_GET_IS_CARD_ACTIVATED, &in)<0) 157 #endif 158 return ERROR; 159 160 if(in) 161 { 162 struct timespec req_ts; 163 req_ts.tv_sec = 0; 164 req_ts.tv_nsec = 50000000; 165 nanosleep (&req_ts, NULL); 166 return OK; 167 } 168 else 169 return ERROR; 170 } 171 else 172 #endif 173 { 174 return OK; 175 } 176 } 177 178 int Sci_Deactivate () 179 { 180 #ifdef DEBUG_IFD 181 printf ("IFD: Deactivating card\n"); 182 #endif 183 184 #ifdef SCI_DEV 185 if(reader[ridx].typ == R_INTERNAL) 186 { 187 int in; 188 189 #if defined(TUXBOX) && (defined(MIPSEL) || defined(PPC) || defined(SH4)) 190 if(ioctl(reader[ridx].handle, IOCTL_GET_IS_CARD_PRESENT, &in)<0) 191 #else 192 if(ioctl(reader[ridx].handle, IOCTL_GET_IS_CARD_ACTIVATED, &in)<0) 193 #endif 194 return ERROR; 195 196 if(in) 197 { 198 if(ioctl(reader[ridx].handle, IOCTL_SET_DEACTIVATE)<0) 199 return ERROR; 200 } 201 202 203 } 204 #endif 205 206 return OK; 207 } 208 209 #endif -
branches/smartreader/csctapi/sci_ioctl.h
r8 r1271 9 9 #define SCI_IOW_MAGIC 's' 10 10 11 #ifndef OS_CYGWIN32 11 #ifdef STB04SCI 12 //-------------------------------------------------------------------------- 13 // reset sci_parameters are optional, i.e. may be NULL 14 // (but not: ioctl (fd, STB04SCI_RESET), 15 // rather ioctl (fd, STB04SCI_RESET, NULL)) 16 //-------------------------------------------------------------------------- 17 18 #define IOCTL_SET_RESET _IO (0x64, 1) 19 #define IOCTL_SET_MODES _IOW(0x64, 2, SCI_MODES) 20 #define IOCTL_GET_MODES _IOR(0x64, 3, SCI_MODES) 21 #define IOCTL_SET_PARAMETERS _IOW(0x64, 4, SCI_PARAMETERS) 22 #define IOCTL_GET_PARAMETERS _IOR(0x64, 5, SCI_PARAMETERS) 23 #define IOCTL_CLOCK_START _IO (0x64, 6) 24 #define IOCTL_CLOCK_STOP _IO (0x64, 7) 25 #define IOCTL_GET_IS_CARD_PRESENT _IO (0x64, 8) 26 #define IOCTL_GET_IS_CARD_ACTIVATED _IO (0x64, 9) 27 #define IOCTL_SET_DEACTIVATE _IO (0x64, 10) 28 #define IOCTL_SET_ATR_READY _IO (0x64, 11) 29 #define IOCTL_GET_ATR_STATUS _IO (0x64, 12) 30 #define IOCTL_DUMP_REGS _IO (0x64, 20) 31 32 #elif defined(OS_CYGWIN32) 12 33 /* ioctl cmd table */ 13 #define IOCTL_SET_RESET _IOW(SCI_IOW_MAGIC, 1, unsigned long)14 #define IOCTL_SET_MODES _IOW(SCI_IOW_MAGIC, 2, SCI_MODES)15 #define IOCTL_GET_MODES _IOW(SCI_IOW_MAGIC, 3, SCI_MODES)16 #define IOCTL_SET_PARAMETERS _IOW(SCI_IOW_MAGIC, 4, SCI_PARAMETERS)17 #define IOCTL_GET_PARAMETERS _IOW(SCI_IOW_MAGIC, 5, SCI_PARAMETERS)18 #define IOCTL_SET_CLOCK_START _IOW(SCI_IOW_MAGIC, 6, unsigned long)19 #define IOCTL_SET_CLOCK_STOP _IOW(SCI_IOW_MAGIC, 7, unsigned long)20 #define IOCTL_GET_IS_CARD_PRESENT _IOW(SCI_IOW_MAGIC, 8, unsigned long)21 #define IOCTL_GET_IS_CARD_ACTIVATED _IOW(SCI_IOW_MAGIC, 9, unsigned long)22 #define IOCTL_SET_DEACTIVATE _IOW(SCI_IOW_MAGIC, 10, unsigned long)23 #define IOCTL_SET_ATR_READY _IOW(SCI_IOW_MAGIC, 11, unsigned long)24 #define IOCTL_GET_ATR_STATUS _IOW(SCI_IOW_MAGIC, 12, unsigned long)25 #define IOCTL_DUMP_REGS _IOW(SCI_IOW_MAGIC, 20, unsigned long)34 #define IOCTL_SET_RESET 1 35 #define IOCTL_SET_MODES 2 36 #define IOCTL_GET_MODES 3 37 #define IOCTL_SET_PARAMETERS 4 38 #define IOCTL_GET_PARAMETERS 5 39 #define IOCTL_SET_CLOCK_START 6 40 #define IOCTL_SET_CLOCK_STOP 7 41 #define IOCTL_GET_IS_CARD_PRESENT 8 42 #define IOCTL_GET_IS_CARD_ACTIVATED 9 43 #define IOCTL_SET_DEACTIVATE 10 44 #define IOCTL_SET_ATR_READY 11 45 #define IOCTL_GET_ATR_STATUS 12 46 #define IOCTL_DUMP_REGS 13 26 47 #else 27 #define IOCTL_SET_RESET 128 #define IOCTL_SET_MODES 229 #define IOCTL_GET_MODES 330 #define IOCTL_SET_PARAMETERS 431 #define IOCTL_GET_PARAMETERS 532 #define IOCTL_SET_CLOCK_START 633 #define IOCTL_SET_CLOCK_STOP 734 #define IOCTL_GET_IS_CARD_PRESENT 835 #define IOCTL_GET_IS_CARD_ACTIVATED 936 #define IOCTL_SET_DEACTIVATE 1037 #define IOCTL_SET_ATR_READY 1138 #define IOCTL_GET_ATR_STATUS 1239 #define IOCTL_DUMP_REGS 1348 #define IOCTL_SET_RESET _IOW(SCI_IOW_MAGIC, 1, unsigned long) 49 #define IOCTL_SET_MODES _IOW(SCI_IOW_MAGIC, 2, SCI_MODES) 50 #define IOCTL_GET_MODES _IOW(SCI_IOW_MAGIC, 3, SCI_MODES) 51 #define IOCTL_SET_PARAMETERS _IOW(SCI_IOW_MAGIC, 4, SCI_PARAMETERS) 52 #define IOCTL_GET_PARAMETERS _IOW(SCI_IOW_MAGIC, 5, SCI_PARAMETERS) 53 #define IOCTL_SET_CLOCK_START _IOW(SCI_IOW_MAGIC, 6, unsigned long) 54 #define IOCTL_SET_CLOCK_STOP _IOW(SCI_IOW_MAGIC, 7, unsigned long) 55 #define IOCTL_GET_IS_CARD_PRESENT _IOW(SCI_IOW_MAGIC, 8, unsigned long) 56 #define IOCTL_GET_IS_CARD_ACTIVATED _IOW(SCI_IOW_MAGIC, 9, unsigned long) 57 #define IOCTL_SET_DEACTIVATE _IOW(SCI_IOW_MAGIC, 10, unsigned long) 58 #define IOCTL_SET_ATR_READY _IOW(SCI_IOW_MAGIC, 11, unsigned long) 59 #define IOCTL_GET_ATR_STATUS _IOW(SCI_IOW_MAGIC, 12, unsigned long) 60 #define IOCTL_DUMP_REGS _IOW(SCI_IOW_MAGIC, 20, unsigned long) 40 61 #endif 41 62 -
branches/smartreader/globals.h
r1254 r1271 152 152 char *RDR_CD_TXT[] = { "cd", "dsr", "cts", "ring", "none", 153 153 #ifdef USE_GPIO 154 "gpio 2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",154 "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7", //felix: changed so that gpio can be used 155 155 #endif 156 156 NULL }; -
branches/smartreader/reader-nagra.c
r1239 r1271 233 233 cs_debug("[nagra-reader] ------------------------------------------"); 234 234 235 memcpy(reader[ridx].hexserial , parte_fija+15, 4);235 memcpy(reader[ridx].hexserial+2, parte_fija+15, 4); 236 236 memcpy(irdId, parte_fija+19, 4); 237 237 memcpy(d1_rsa_modulo,parte_fija+23,88); … … 725 725 else 726 726 { 727 //check ECM prov id 728 if (memcmp(&reader[ridx].prid[0][2], er->ecm+5, 2)) 729 return (0); 730 727 731 // ecm_data: 80 30 89 D3 87 54 11 10 DA A6 0F 4B 92 05 34 00 ... 728 732 //serial_data: A0 CA 00 00 8C D3 8A 00 00 00 00 00 10 DA A6 0F . … … 751 755 int nagra2_do_emm(EMM_PACKET *ep) 752 756 { 753 cs_debug("[nagra-reader] do_emm #########################################################"); 754 cs_debug("[nagra-reader] do_emm #########################################################"); 755 if(!do_cmd(ep->emm[8],ep->emm[9]+2,0x84,0x02,ep->emm+8+2)) 756 { 757 cs_debug("[nagra-reader] nagra2_do_emm failed"); 758 return (0); 759 } 760 cs_sleepms(300); 761 nagra2_post_process(); 757 if (!is_tiger) 758 { 759 if(!do_cmd(ep->emm[8],ep->emm[9]+2,0x84,0x02,ep->emm+8+2)) 760 { 761 cs_debug("[nagra-reader] nagra2_do_emm failed"); 762 return (0); 763 } 764 cs_sleepms(300); 765 nagra2_post_process(); 766 } 767 else 768 { 769 //check EMM prov id 770 if (memcmp(&reader[ridx].prid[0][2], ep->emm+10, 2)) 771 return (0); 772 773 // emm_data: 82 70 8E 00 00 00 00 00 D3 87 8D 11 C0 F4 B1 27 2C 3D 25 94 ... 774 //serial_data: A0 CA 00 00 8C D3 8A 01 00 00 00 00 C0 F4 B1 27 2C 3D 25 94 ... 775 unsigned char emm_trim[150]; 776 memset(emm_trim, 0, 150); 777 memcpy(&emm_trim[5], ep->emm+3+5+2+2, ep->emm[9]+2); 778 if(!do_cmd(ep->emm[8],ep->emm[9]+5,0x53,0x16, emm_trim)) 779 { 780 cs_debug("[nagra-reader] nagra2_do_emm failed"); 781 return (0); 782 } 783 cs_sleepms(300); 784 } 762 785 return 1; 763 786 }
Note:
See TracChangeset
for help on using the changeset viewer.