HowTo Assign a permanent device name to smargo for DM800,DM800se,DM8000,7020si,PC

There is 1 reply in this Thread which was already clicked 4,839 times. The last Post () by magische_vogel.

  • Hi,


    Today i will explain how to assign a permanent device name to your smargo readers on Dreambox 7020si STB. How to for the other models and PC Linux will come later too. Most of the time when you plug a usb device into dreambox or a pc the linux kernel assign to it a device name and point it to a specfic port. (ex /dev/usb/tts/0
    /dev/usb/tts/1, /dev/usb/tts/2, /dev/usb/tts/3,
    for my 4 smargo readers) but sometimes when you reboot the system the kernel don't assign the same port to the same previously connected usb device, this will cause issues for the EMU trying to point to a specific SmartCard. At the end of this tutorial you will have a shell script that will solve this issues by assigning a device name to your USB devices, this names remain the same even you restart the system or you do a hotplug of the device all that you need to do is to call this script before you start your EMU. This names will be used in the EMU conf file instead of the names assigned by the linux kernel.


    Requirements :
    a. Dreambox 7020si.
    b. One or more smargo smartreader(s) with firmware 1.4 (Later i will give the link to download all the necessary tools and files to accomplish this work).
    c. USB HUB if you plan to use more than 1 samrgo smartreader.


    Notes :
    All the used Dreambox STB's are genuine.
    The image running in my DM7020si is the Gemini Project Version 4.70. For the older versions the drivers are not delivred with the system so you must install them manualy.


    To enable the Chipset FTDI drivers go to Blue Panel ----> (3) Extras / Setup ----> USB-CardReader drop down the list and select the item Chipset FTDI finally push the green button on the remote controle to save the changes. Push the exit Button twice to quit all the opened windows. Now it is time to reboot the STB to changes take effect. Push the button MENU ----> (9) Shutdown ----> restart.


    To display all the attached USB devices to the DM7020si coonect to the DM7020si using putty and issue this command:

    Code
    cat /proc/bus/usb/devices

    , in my case the output look like this :



    Code
    root@dm7020:~> cat /proc/tty/driver/usbserial
    usbserinfo:1.0 driver:v2.0
    [COLOR=#8b4513]0[/COLOR]: module:ftdi_sio name:"FTDI FT232BM Compatible" vendor:0403 product:6001 num_ports:1 port:1 path:usb-ocp-1.[COLOR=#0000cd]2[/COLOR]
    [COLOR=#8b4513]1[/COLOR]: module:ftdi_sio name:"FTDI FT232BM Compatible" vendor:0403 product:6001 num_ports:1 port:1 path:usb-ocp-1.[COLOR=#0000cd]4[/COLOR]
    [COLOR=#8b4513]2[/COLOR]: module:ftdi_sio name:"FTDI FT232BM Compatible" vendor:0403 product:6001 num_ports:1 port:1 path:usb-ocp-1.[COLOR=#0000cd]5[/COLOR]
    [COLOR=#8b4513]3[/COLOR]: module:ftdi_sio name:"FTDI FT232BM Compatible" vendor:0403 product:6001 num_ports:1 port:1 path:usb-ocp-1.[COLOR=#0000cd]7[/COLOR]
    root@dm7020:~>


    Code
    root@dm7020:~> ls /dev/usb/tts/
    [COLOR=#8b4513]0  1  2  3[/COLOR][COLOR=#0000ff]
    [/COLOR]root@dm7020:~>


    now i will explain the relation between the 3 outputs :


    Port 0 in the command output of "ls /dev/usb/tts/" correspond to the port 0 in the command output of "cat /proc/tty/driver/usbserial" this is the device file created for the smargo smart reader connected in the hub port number usb-ocp-1."2" the "2" value is obtained from the addition of 1 to the value of Port=01 obtained from the command output of "cat /proc/bus/usb/devices " which represent the smargo with SerialNumber=Reader 150.
    Here is a table that explain the conection between the device file created by the kernel and the smargo smartreaders SerialNumber which will be used to create the persistent device names.


    Code
    [COLOR=#0000cd][COLOR=#8b4513][COLOR=#8b4513][COLOR=#0000cd][COLOR=#800000][COLOR=#ff0000]@@@WCF_PRE_LINEBREAK@@@[/COLOR][/COLOR][/COLOR][/COLOR][/COLOR][/COLOR]CMD3                               CMD2                                        CMD1 
    "ls /dev/usb/tts/"       cat /proc/tty/driver/usbserial    cat /proc/bus/usb/devices
    device file       device file   Hub-port               Hub port serial number
    [COLOR=#0000cd][COLOR=#8b4513][COLOR=#8b4513][COLOR=#0000cd][COLOR=#800000][COLOR=#ff0000][COLOR=#8b4513][COLOR=#8b4513]0 [COLOR=#8b4513]<--------[COLOR=#8b4513]--------[COLOR=#8b4513]----[/COLOR][/COLOR][/COLOR][/COLOR][COLOR=#222222] [COLOR=#8b4513][COLOR=#8b4513]0 <-------- [/COLOR][/COLOR][/COLOR][/COLOR][COLOR=#0000cd]2 <------- 1    + [COLOR=#800000]Port=01 <- [COLOR=#ff0000]Reader 150[/COLOR][/COLOR][/COLOR]@@@WCF_PRE_LINEBREAK@@@[COLOR=#8b4513]1 [COLOR=#8b4513]<-------------------- [/COLOR][/COLOR][COLOR=#8b4513][COLOR=#8b4513]1 [COLOR=#8b4513]<-------- [/COLOR][/COLOR][/COLOR][COLOR=#0000cd]4[COLOR=#0000cd] <------- 1    + [/COLOR][COLOR=#800000]Port=03 [/COLOR][COLOR=#800000]<- [/COLOR][COLOR=#ff0000]Reader 128[/COLOR][/COLOR]@@@WCF_PRE_LINEBREAK@@@[COLOR=#8b4513]2 [COLOR=#8b4513]<-------------------- [/COLOR][COLOR=#8b4513][COLOR=#8b4513]2 [COLOR=#8b4513]<-------- [/COLOR][/COLOR][/COLOR][COLOR=#0000cd]5[COLOR=#0000cd] <------- 1    + [/COLOR][COLOR=#800000]Port=04 [COLOR=#800000]<- [/COLOR][COLOR=#ff0000]Reader 215[/COLOR][/COLOR][/COLOR][/COLOR]@@@WCF_PRE_LINEBREAK@@@[COLOR=#8b4513]3 [COLOR=#8b4513]<-------------------- [/COLOR][COLOR=#0000cd][COLOR=#8b4513][COLOR=#8b4513]3 [COLOR=#8b4513]<-------- [/COLOR][COLOR=#0000cd]7[COLOR=#0000cd] <------- 1    + [/COLOR][COLOR=#800000]Port=06 [COLOR=#800000]<- [/COLOR][COLOR=#ff0000]Reader 216 [/COLOR][/COLOR][/COLOR][/COLOR][/COLOR][/COLOR][/COLOR]@@@WCF_PRE_LINEBREAK@@@[/COLOR][/COLOR][/COLOR][/COLOR][/COLOR][/COLOR]


    Well the sh script will use the CMD3 and CMD2 commands to collect data create then create the persistent devices names (symlinks) to the correponding devices files created by the linux kernel.Here is the script code :



    Give it a name ex : RenameUSBReaders.sh save it to /var/script/ directory.
    Issue this commande to make it executable : chmod 755 /var/script/RenameUSBReaders.sh
    Issue this command : /var/script/RenameUSBReaders.sh
    if every things is ok you will get an ouputs. To check if the new devices names are created issue this commande : "ls -la /dev/Reader_*"


    Code
    root@dm7020:~> ls -la /dev/Reader_*
    lr-xr-xr-x    1 root     root           14 Nov  7 17:50 /dev/Reader_128_CSATV4S19E -> /dev/usb/tts/1
    lr-xr-xr-x    1 root     root           14 Nov  7 17:50 /dev/Reader_150_BISTVV4S13E -> /dev/usb/tts/0
    lr-xr-xr-x    1 root     root           14 Nov  7 17:50 /dev/Reader_215_SRGV4S13E -> /dev/usb/tts/2
    lr-xr-xr-x    1 root     root           14 Nov  7 17:50 /dev/Reader_216_JSCV4S7W13E26E -> /dev/usb/tts/3
    root@dm7020:~>


    Now you can use the new created symlinks into your EMU conf without any issues.
    Next post i will give some examples on how to use the new device files to communicate with the smargo smart reader.


    Good Luck


    To be continued.


    magische_vogel

  • Now i will continue the tutorial for DM800HD and DM800HDse both of them use Enigma2 Project not like DM7020si that use Enigma1 project. E2 use the udevs programme already used by linux system to manage all kind of used devices. So the commands used are diffirent but the idea remain same.As you will see i will not use the same commands as used for DM7020si (By the way the 2 commandes used for DM7020si works also for the DM800HD but this involve more instructions in the shell script to get the same results so i prefer using the udevadmin program).


    Note: This work is original it is not copied from any other ressources or forum.


    1.Requirements:
    a. DM800HD or DM800HDse
    b. One or more smargo smartreader(s) with firmware 1.4 (Later i will give the link to download all the necessary tools and files to accomplish this work).
    c. USB HUB if you plan to use more than 1 samrgo smartreader.


    Connect to your DM800HD using putty and connect all your smargo smart readers. In my case i have only one smargo attached to my Dreambox800HD via my d-link usb hub.From the prompt issue this command : "udevadm info -a -p $(udevadm info -q path -n ttyUSB0)"
    This command will query the udev database for every attached device specified in the command line in our example is ttyUSB0
    Note : You can use the same commands for DM7020si to get the same infos. I prefer using the udevadmin program to avoid the connection between the 2 commands like DM7020si example.The sh script will loop through all the ttyUSBxx devices attached to the DM800HD extract the Serial Reader for each one then make some checks and create a persistent symlinklink to point to the corresponding ttyUSBxx port, so even after many restarts the Serial Number will be used to identify which ttyUSBxx is assigned to and create the same persistent name that will be used in the EMU's config file.



    The output of this command show us that the ATTRS{serial}=="Reader 246" of smargo is connected to the port : looking at parent device '/devices/platform/brcm-ehci.0/usb1/1-2/1-2.5': of my D-link usb hub and the kernel assigned a device file /dev/ttyUSB0 to it.
    It is time to see the sh script used to assign a persistent names to connected readers based on the serial number of each smargo smart reader.This script can be used with any usb device that have a unique ID like serial number with some changes in script code of course.If you need help with other usb readers post the type of reader used and the outputs of the 2 commands in case you use DM7020si or the result of the udevinfo query.



    Give it a name ex : RenameUSBReaders.sh save it to /usr/script/ directory.
    Issue this command to make it executable : chmod 755 /usr/script/GenUSBReadersPersNames.sh
    Issue this command : /usb/script/GenUSBReadersPersNames.sh
    if every things is ok you will get an ouputs. To check if the new persistent names are created correctly issue this command : "ls -la /dev/Reader_*"
    In my case the new persistent name is created with success "/dev/Reader_246_JSCV4" and point to device file name "/dev/ttyUSB0".

    Code
    root@dm800:~# ls -la /dev/Reader_*
    lrwxrwxrwx    1 root     root           12 Nov  7 11:24 /dev/Reader_246_JSCV4 -> /dev/ttyUSB0
    root@dm800:~#


    Now you can use the new created symlinks into your EMU conf without any issues.


    OSCAM Example :
    Edit the file: /var/tuxbox/config/oscam.server
    and configure your reader to use the persistant names generated by the script instead of those created by the kernel.



    Next post i will continue with the PC linux, i will show you how to use the same script and how to use udev rules directly without my script to create a persistent names for any kind of USB device with unique ID. (unique id for smargo smart reader added only in firmware 1.4 so make sure that your smargo is already updated with this version of firmware).


    Good luck,


    Magische_Vogel

OSCam Support Forum

Configs, discussion, downloads and guides for OSCam Softcam.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!