←  [EN] Third-Party Development

Forums

»

playing with smart card reader using conso...

zember's Photo zember 22 Jul 2013

hi, would like to get few responses from card, which is in native SC reader.

So I have VU+ DUO and OpenPLi 3.0 . I have two smart card readers /dev/sci0 and /dev/sci1. I would like to connect to one of them from console level. Is this possible? I know that this is not right way. Because cards talking in binary, anyway i need to do this. I wolud like to make just few comands like set_baudrate, make reset/get ATR, send few bytes and get response. Probably i need to talk directly to driver or somethink, can you help me? Please.

Regards,

P.S. I would rather not write python scripts unless it will be short and I can send it to  /tmp/ folder

Quote

Erik Slagter's Photo Erik Slagter 22 Jul 2013

The baudrate you can probably set using this syntax:

 

stty 19200 < /dev/sci1

stty -a < /dev/ttysci1

Quote

zember's Photo zember 22 Jul 2013

unfortunatly not working

 

root@vuduo:~# stty 19200 < /dev/sci1
stty: standard input: Invalid argument
root@vuduo:~# stty -a < /dev/ttysci1
-sh: can't open /dev/ttysci1: no such file
root@vuduo:~# stty -a < /dev/sci1
stty: standard input: Invalid argument
root@vuduo:~#
 

Quote

zember's Photo zember 22 Jul 2013

I'm sorry for writing under my post, but I can't not edit my last post.

root@vuduo:~# tty /dev/sci1
/dev/pts/0
root@vuduo:~# stty 9600 < /dev/pts/0
root@vuduo:~# stty -a < /dev/pts/0
speed 9600 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab3 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
root@vuduo:~#
 

If this is correct answer, what is the next step?

Quote

Erik Slagter's Photo Erik Slagter 22 Jul 2013

Now you're adjusting your current pseudo terminal, that won't work.

 

Also, apparently the sci interface doesn't support the stty interface, so it's probably done using ioctl's. You may want to have a look at the source of oscam.


Edited by Erik Slagter, 22 July 2013 - 13:40.
Quote

zember's Photo zember 22 Jul 2013

It is very hard to read oscam sources I'm not good in C,

what do you think about this? :

 

here is few sci driver commands: http://dev.duckbox.i...c656a21ea775236

 

I'm trying to call them using python:

root@vuduo:/usr/lib# python2.7
Python 2.7.2 (default, Aug 31 2012, 05:24:11)
[GCC 4.6.4 20120303 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> import fcntl
>>> devicehandle = open('/dev/sci1', 'rw')
>>> fcntl.ioctl(devicehandle, IOCTL_SET_RESET, buff)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'IOCTL_SET_RESET' is not defined
 

Quote