Cardreader unter freetz fest verlinken mit udev

Aus Zebradem WIKI
Zur Navigation springenZur Suche springen

Das Board mit Freiheiten




Einleitung

Das zuweisen von Cardreadern mit udev unter anderen System ist ja bekannt : USB-Reader fest verlinken

Das funktioniert jetzt auch unter freetz ab trunk 8383 http://freetz.org/wiki/patches/custom_udev_rules]patches/custom_udev_rules

geeignete Cardreader:

  • smargo FW 1.03 über Vendor ID
  • smargo FW 1.04- 1.07 über Serial
  • Apollo Cardreader über Serial
  • Easymouse2 über Serial
  • WB Smartmouse USB über Vendor ID
  • und andere

Beispiel smargo FW 1.07 und Oscam

Als erstes Serial auslesen per telnet :

cat /proc/bus/usb/devices

Ergebnis:

T:  Bus=01 Lev=02 Prnt=02 Port=03 Cnt=02 Dev#=  4 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0403 ProdID=6001 Rev= 4.00
S:  Manufacturer=Argolis BV
S:  Product=Smartreader plus
S:  SerialNumber=12345678
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbfs
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms

Die Serial tragen wir jetzt über das freetz WI unter Menue Punkt freetz udev_first ein

SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{serial}=="Reader Serial", SYMLINK+="Symlink

Hier wird die ausgelesene Serial eingetragen. Hier wird der Symlink eingetragen.

SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{serial}=="12345678", SYMLINK+="smargo1"

Fritzbox neu starten damit die änderungen übernommen werden , die rules sind dann fest gespeichert

Anschliessend In der oscam.server als device den erstellten symlink eintragen

[reader]
label                         = smargo1
protocol                      = mouse
device                        = /dev/smargo1
smargopatch                   = 1
fallback                      = 1
caid                          = 1838
rsakey                        = B5................FF
boxkey                        = A7.......7C
detect                        = cd
mhz                           = 369
cardmhz                       = 368
group                         = 1
emmcache                      = 1,3,2
2012/01/13  8:38:59      C04 r reader thread started (thread=     C04, label=smargo1, device=[COLOR="#FFFF00"]/dev/smargo1[/COLOR], detect=cd, mhz=369, cardmhz=368)
2012/01/13  8:39:02      C04 r smargo1 card detected
2012/01/13  8:39:09      C04 r ATR: 3F FF 95 00 FF 91 81 71 FE 47 00 44 4E 41 53 50 31 34 32 20 52 65 76 47 30 36 12 
2012/01/13  8:39:11      C04 r Maximum frequency for this card is formally 5 Mhz, clocking it to 3.69 Mhz
2012/01/13  8:39:12      C04 r detect native nagra card
2012/01/13  8:39:12      C04 r -----------------------------------------
2012/01/13  8:39:12      C04 r |id  |tier    |valid from  |valid to    |
2012/01/13  8:39:12      C04 r +----+--------+------------+------------+
2012/01/13  8:39:13      C04 r found cardsystem
2012/01/13  8:39:13      C04 r ROM:    D N A S P 1 4 2
2012/01/13  8:39:13      C04 r REV:    R e v G 0 6
2012/01/13  8:39:13      C04 r SER:    12 34 56 78
2012/01/13  8:39:13      C04 r CAID:   1838
2012/01/13  8:39:13      C04 r Prv.ID: 00 00 04 01 (sysid)
2012/01/13  8:39:13      C04 r Prv.ID: 00 00 00 00 
2012/01/13  8:39:13      C04 r Prv.ID: 00 00 11 03 
2012/01/13  8:39:13      C04 r [nagra-reader] ready for requests
2012/01/13  8:39:13      400 s init for all local cards done
2012/01/13 9:12:10 1005 c um02 (1838&001103/7D67/92:F57A): found (331 ms) by smargo1 (of 0 avail 0) 
2012/01/13 9:12:10 1005 c um02 (1838&001103/7D66/92:371C): found (317 ms) by smargo1 (of 0 avail 0) 
2012/01/13 9:12:20 1005 c um02 (1838&001103/7D67/92:DF0A): found (329 ms) by smargo1 (of 0 avail 0) 
2012/01/13 9:12:20 1005 c um02 (1838&001103/7D66/92:1CB5): found (336 ms) by smargo1 (of 0 avail 0) 

Beispiel smargo FW 1.07 und CCcam

SERIAL READER : /dev/smargo1
Jan 13 10:06:00 fritz daemon.debug CCcam: ======================================================================
Jan 13 10:06:00 fritz daemon.debug CCcam: starting CCcam 2.1.1 compiled on May  2 2009@20:00:30
Jan 13 10:06:00 fritz daemon.debug CCcam: ======================================================================
Jan 13 10:06:00 fritz daemon.debug CCcam: online using nodeId ff997a593223778b
Jan 13 10:06:00 fritz daemon.debug CCcam: DM7025 detected
Jan 13 10:06:00 fritz daemon.debug CCcam: create 8 cam device(s)
Jan 13 10:06:00 fritz daemon.debug CCcam: card detect fail
Jan 13 10:06:00 fritz daemon.debug CCcam: calculated EGT: 0 us
Jan 13 10:06:00 fritz daemon.debug CCcam: irdeto card found
Jan 13 10:06:01 fritz daemon.debug CCcam: camkey challenge ok
Jan 13 10:06:01 fritz daemon.debug CCcam: card added to broker with caid 1722
Welcome to CCcam 2.1.1 server

card reader /dev/smargo1
handled 2(2) ecms and 7(7) emms
Caid 1722 Betacrypt ACS 900 TEL
Cardserial 9002012346 (112233)

Beispiel WB smartmouse USB und CCcam

(getestet zusammen mit 1 smargo und 1 WB Smartmouse)

Da dieser keine Serial beutzt , wird hier zum Beispiel die Vendor Nummer genutzt. Hierbei darf dann aber auch nur ein Cardreader dieser Art vorhanden sein weil die Vendor ID s identisch sind. Bei mehreren Cardreadern der selben Art ohne Serial funktioniert das nicht .

T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=104f ProdID=0002 Rev= 4.00
S:  Manufacturer=WB Electronics ApS
S:  Product=Smartmouse USB
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=ftdi_sio
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{serial}=="[COLOR="#00FFFF"]12345678[/COLOR]", SYMLINK+="[COLOR="#FFFF00"]smargo1
SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{idVendor}=="104f", SYMLINK+="smartmouse1"
SERIAL READER : /dev/smartmouse1
Welcome to CCcam 2.1.1 server

card reader /dev/smartmouse1
handled 47(47) ecms and 7(7) emms
Caid 1722 Betacrypt ACS 900 TEL
Cardserial 9002012346 (112233)mms

Argolis Triple

Leider funktioniert die Methode nicht mit Serial Dazu nehmen wir die "Interfacenumber"

listusb -v
Bus 001 Device 002: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0403 Future Technology Devices International, Ltd
  idProduct          0x6011 FT4232H Quad HS USB-UART/FIFO IC
  bcdDevice            5.00
  iManufacturer           1 Argolis
  iProduct                2 Triple Reader+
  iSerial                 3 00000044
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength        19968
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              150mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 Triple Reader+
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x4000  1x 0 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x4000  1x 0 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 Triple Reader+
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x4000  1x 0 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x4000  1x 0 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 Triple Reader+
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x4000  1x 0 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x06  EP 6 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x4000  1x 0 bytes
        bInterval               0
Device Status:     0x4c00
  (Bus Powered)


folgendes einfach im freetz-WebIF in der udev_first eintragen, dann sollten alle drei Ports erkannt und eingebunden werden.

SUBSYSTEMS=="usb",KERNEL=="ttyUSB*", ATTRS{interface}=="Triple Reader+",ATTRS{bInterfaceNumber}=="00", SYMLINK+="triple1"
SUBSYSTEMS=="usb",KERNEL=="ttyUSB*", ATTRS{interface}=="Triple Reader+",ATTRS{bInterfaceNumber}=="01", SYMLINK+="triple2"
SUBSYSTEMS=="usb",KERNEL=="ttyUSB*", ATTRS{interface}=="Triple Reader+",ATTRS{bInterfaceNumber}=="02", SYMLINK+="triple3"


nach einem Reboot sollte die Eingabe von "ls -la /dev |grep ttyUSB" folgendes Ergebniss liefern:


root@fritzbox_7270:/var/mod/root# ls -la /dev |grep ttyUSB
lrwxrwxrwx    1 root     root             7 Mar  8 18:03 triple1 -> ttyUSB0
lrwxrwxrwx    1 root     root             7 Mar  8 18:03 triple2 -> ttyUSB1
lrwxrwxrwx    1 root     root             7 Mar  8 18:03 triple3 -> ttyUSB2


eingetragen in der CCcam.cfg könnte es dann z.B so aussehen:

SERIAL READER : /dev/triple3 smartreader+
card reader /dev/triple3
handled 728(614) ecms and 0(0) emms 
Caid 1702 Betacrypt ACS 900 GER[/CODE]

2.Version

lsusb -d 403:6011 -v | grep iSerial
Serial number: 00000001
Readername: triplereader_
SUBSYSTEMS=="usb" ENV{ID_IFACE}="$attr{bInterfaceNumber}"
KERNEL=="ttyUSB*", ATTRS{serial}=="00000001" SYMLINK+="triplereader$env{ID_IFACE}" 
P1 = /dev/triplereader00
P2 = /dev/triplereader01
P3 = /dev/triplereader02

Quadmouse

listusb -v
Bus 001 Device 005: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
Device Descriptor:
bLength                18
bDescriptorType         1
bcdUSB               2.00
bDeviceClass            0 (Defined at Interface level)
bDeviceSubClass         0
bDeviceProtocol         0
bMaxPacketSize0        64
idVendor           0x0403 Future Technology Devices International, Ltd
idProduct          0x6011 FT4232H Quad HS USB-UART/FIFO IC
bcdDevice            8.00
iManufacturer           1 FTDI
iProduct                2 <span style="color:#006400">Quad RS232-HS</span>
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          101
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 <span style="color:#006400">Quad RS232-HS</span>
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 <span style="color:#006400">Quad RS232-HS</span>
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 <span style="color:#006400">Quad RS232-HS</span>
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x06  EP 6 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 <span style="color:#006400">Quad RS232-HS</span>
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x87  EP 7 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x08  EP 8 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)
SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{interface}=="Quad RS232-HS", ATTRS{bInterfaceNumber}=="00", SYMLINK+="quad1"
SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{interface}=="Quad RS232-HS", ATTRS{bInterfaceNumber}=="01", SYMLINK+="quad2"
SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{interface}=="Quad RS232-HS", ATTRS{bInterfaceNumber}=="02", SYMLINK+="quad3"
SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{interface}=="Quad RS232-HS", ATTRS{bInterfaceNumber}=="03", SYMLINK+="quad4"