How do I get the type of internal card reader?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I have a Linux box which runs Busybox. There are two card reader build in. How can I get the type of the card readers?



I tried lshw, hwinfo and lspci but these commands are not implemented on Busybox.




Hello Stéphane Chazelas,



Thank you very much for your detailed answer. I tried it. However grep doesn't find anything.



# l `find /sys/devices -path '*/usb*/configuration'`
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470300.ehci_v2/usb3/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470400.ohci_v2/usb7/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470500.ehci_v2/usb4/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470600.ohci_v2/usb8/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0471000.xhci_v2/usb1/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0471000.xhci_v2/usb2/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/5-1/5-1.1/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/5-1/5-1.2/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/5-1/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480400.ohci_v2/usb9/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480500.ehci_v2/usb6/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480600.ohci_v2/usb10/configuration
# l `find /sys/devices -path '*/pci*/driver'`
dr-xr-xr-x 2 root root 0 Oct 2 19:20 .
dr-xr-xr-x 4 root root 0 Oct 2 19:20 ..
-r--r--r-- 1 root root 0 Oct 2 19:31 devices
# l /proc/bus/pci/devices
-r--r--r-- 1 root root 0 Oct 2 19:31 /proc/bus/pci/devices









share|improve this question























  • What do you mean by type? Do you want the make and model of the device?
    – Stéphane Chazelas
    Oct 2 '17 at 14:03










  • Yes, I want to know the vendor and model.
    – musbach
    Oct 2 '17 at 17:33














up vote
3
down vote

favorite












I have a Linux box which runs Busybox. There are two card reader build in. How can I get the type of the card readers?



I tried lshw, hwinfo and lspci but these commands are not implemented on Busybox.




Hello Stéphane Chazelas,



Thank you very much for your detailed answer. I tried it. However grep doesn't find anything.



# l `find /sys/devices -path '*/usb*/configuration'`
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470300.ehci_v2/usb3/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470400.ohci_v2/usb7/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470500.ehci_v2/usb4/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470600.ohci_v2/usb8/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0471000.xhci_v2/usb1/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0471000.xhci_v2/usb2/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/5-1/5-1.1/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/5-1/5-1.2/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/5-1/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480400.ohci_v2/usb9/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480500.ehci_v2/usb6/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480600.ohci_v2/usb10/configuration
# l `find /sys/devices -path '*/pci*/driver'`
dr-xr-xr-x 2 root root 0 Oct 2 19:20 .
dr-xr-xr-x 4 root root 0 Oct 2 19:20 ..
-r--r--r-- 1 root root 0 Oct 2 19:31 devices
# l /proc/bus/pci/devices
-r--r--r-- 1 root root 0 Oct 2 19:31 /proc/bus/pci/devices









share|improve this question























  • What do you mean by type? Do you want the make and model of the device?
    – Stéphane Chazelas
    Oct 2 '17 at 14:03










  • Yes, I want to know the vendor and model.
    – musbach
    Oct 2 '17 at 17:33












up vote
3
down vote

favorite









up vote
3
down vote

favorite











I have a Linux box which runs Busybox. There are two card reader build in. How can I get the type of the card readers?



I tried lshw, hwinfo and lspci but these commands are not implemented on Busybox.




Hello Stéphane Chazelas,



Thank you very much for your detailed answer. I tried it. However grep doesn't find anything.



# l `find /sys/devices -path '*/usb*/configuration'`
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470300.ehci_v2/usb3/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470400.ohci_v2/usb7/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470500.ehci_v2/usb4/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470600.ohci_v2/usb8/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0471000.xhci_v2/usb1/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0471000.xhci_v2/usb2/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/5-1/5-1.1/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/5-1/5-1.2/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/5-1/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480400.ohci_v2/usb9/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480500.ehci_v2/usb6/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480600.ohci_v2/usb10/configuration
# l `find /sys/devices -path '*/pci*/driver'`
dr-xr-xr-x 2 root root 0 Oct 2 19:20 .
dr-xr-xr-x 4 root root 0 Oct 2 19:20 ..
-r--r--r-- 1 root root 0 Oct 2 19:31 devices
# l /proc/bus/pci/devices
-r--r--r-- 1 root root 0 Oct 2 19:31 /proc/bus/pci/devices









share|improve this question















I have a Linux box which runs Busybox. There are two card reader build in. How can I get the type of the card readers?



I tried lshw, hwinfo and lspci but these commands are not implemented on Busybox.




Hello Stéphane Chazelas,



Thank you very much for your detailed answer. I tried it. However grep doesn't find anything.



# l `find /sys/devices -path '*/usb*/configuration'`
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470300.ehci_v2/usb3/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470400.ohci_v2/usb7/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470500.ehci_v2/usb4/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0470600.ohci_v2/usb8/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0471000.xhci_v2/usb1/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0471000.xhci_v2/usb2/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/5-1/5-1.1/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/5-1/5-1.2/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/5-1/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480300.ehci_v2/usb5/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480400.ohci_v2/usb9/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480500.ehci_v2/usb6/configuration
-r--r--r-- 1 root root 4096 Oct 2 19:14 /sys/devices/rdb.3/f0480600.ohci_v2/usb10/configuration
# l `find /sys/devices -path '*/pci*/driver'`
dr-xr-xr-x 2 root root 0 Oct 2 19:20 .
dr-xr-xr-x 4 root root 0 Oct 2 19:20 ..
-r--r--r-- 1 root root 0 Oct 2 19:31 devices
# l /proc/bus/pci/devices
-r--r--r-- 1 root root 0 Oct 2 19:31 /proc/bus/pci/devices






busybox






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 2 '17 at 17:42

























asked Oct 2 '17 at 10:50









musbach

22129




22129











  • What do you mean by type? Do you want the make and model of the device?
    – Stéphane Chazelas
    Oct 2 '17 at 14:03










  • Yes, I want to know the vendor and model.
    – musbach
    Oct 2 '17 at 17:33
















  • What do you mean by type? Do you want the make and model of the device?
    – Stéphane Chazelas
    Oct 2 '17 at 14:03










  • Yes, I want to know the vendor and model.
    – musbach
    Oct 2 '17 at 17:33















What do you mean by type? Do you want the make and model of the device?
– Stéphane Chazelas
Oct 2 '17 at 14:03




What do you mean by type? Do you want the make and model of the device?
– Stéphane Chazelas
Oct 2 '17 at 14:03












Yes, I want to know the vendor and model.
– musbach
Oct 2 '17 at 17:33




Yes, I want to know the vendor and model.
– musbach
Oct 2 '17 at 17:33










1 Answer
1






active

oldest

votes

















up vote
3
down vote



accepted










Card readers are often USB devices. If so, you could do something like:



find /sys/devices -path '*/usb*/configuration' -exec 
grep -lx 'CARD READER' + | awk -F/ -vOFS=/ '
NF--
getline idv < ($0 "/idVendor")
getline idp < ($0 "/idProduct")
getline v < ($0 "/manufacturer")
getline p < ($0 "/product")
print idv":"idp" "v" "p'


To get vendor/product IDs and names (as reported by the kernel). That is look for USB devices whose configuration is set to CARD READER and extract the content of the vendorID, productID, manufacturer and product files located in the parent directory of the one containing the configuration file.



For PCI devices, this would catch at least the devices using the drivers below. busybox find doesn't support GNU find's -lname predicate, so we'd need something like:



find /sys/devices -path '*/pci*/driver' -type l -exec readlink ; -print |
awk -F/ -v OFS=/ '
BEGINd["cb710"]d["r592"]d["r852"]d["rts5208"]d["rtsx_pci"]
$NF in d
getline
NF--
getline v < ($0 "/vendor")
getline p < ($0 "/device")
print substr(v, 3) ":" substr(p, 3)
'


There's no configuration file that we can use this time to determine the class of device (actually, there is a class file for the PCI device class, but I can see it being 0xff00 (Misc) for a Realtek device here, there is no PCI device class dedicate to "card readers" so we can't rely on it). So instead we look for drivers symlinks that point to any of the drivers known to be drivers for PCI card readers, and get the vendor/product IDs in paths relative to that.



A simpler approach is to use /proc/bus/pci/devices:



awk '
BEGINd["cb710"]d["r592"]d["r852"]d["rts5208"]d["rtsx_pci"]
$NF in d print substr($2, 1, 4) ":" substr($2, 5)
' < /proc/bus/pci/devices





share|improve this answer






















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f395620%2fhow-do-i-get-the-type-of-internal-card-reader%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote



    accepted










    Card readers are often USB devices. If so, you could do something like:



    find /sys/devices -path '*/usb*/configuration' -exec 
    grep -lx 'CARD READER' + | awk -F/ -vOFS=/ '
    NF--
    getline idv < ($0 "/idVendor")
    getline idp < ($0 "/idProduct")
    getline v < ($0 "/manufacturer")
    getline p < ($0 "/product")
    print idv":"idp" "v" "p'


    To get vendor/product IDs and names (as reported by the kernel). That is look for USB devices whose configuration is set to CARD READER and extract the content of the vendorID, productID, manufacturer and product files located in the parent directory of the one containing the configuration file.



    For PCI devices, this would catch at least the devices using the drivers below. busybox find doesn't support GNU find's -lname predicate, so we'd need something like:



    find /sys/devices -path '*/pci*/driver' -type l -exec readlink ; -print |
    awk -F/ -v OFS=/ '
    BEGINd["cb710"]d["r592"]d["r852"]d["rts5208"]d["rtsx_pci"]
    $NF in d
    getline
    NF--
    getline v < ($0 "/vendor")
    getline p < ($0 "/device")
    print substr(v, 3) ":" substr(p, 3)
    '


    There's no configuration file that we can use this time to determine the class of device (actually, there is a class file for the PCI device class, but I can see it being 0xff00 (Misc) for a Realtek device here, there is no PCI device class dedicate to "card readers" so we can't rely on it). So instead we look for drivers symlinks that point to any of the drivers known to be drivers for PCI card readers, and get the vendor/product IDs in paths relative to that.



    A simpler approach is to use /proc/bus/pci/devices:



    awk '
    BEGINd["cb710"]d["r592"]d["r852"]d["rts5208"]d["rtsx_pci"]
    $NF in d print substr($2, 1, 4) ":" substr($2, 5)
    ' < /proc/bus/pci/devices





    share|improve this answer


























      up vote
      3
      down vote



      accepted










      Card readers are often USB devices. If so, you could do something like:



      find /sys/devices -path '*/usb*/configuration' -exec 
      grep -lx 'CARD READER' + | awk -F/ -vOFS=/ '
      NF--
      getline idv < ($0 "/idVendor")
      getline idp < ($0 "/idProduct")
      getline v < ($0 "/manufacturer")
      getline p < ($0 "/product")
      print idv":"idp" "v" "p'


      To get vendor/product IDs and names (as reported by the kernel). That is look for USB devices whose configuration is set to CARD READER and extract the content of the vendorID, productID, manufacturer and product files located in the parent directory of the one containing the configuration file.



      For PCI devices, this would catch at least the devices using the drivers below. busybox find doesn't support GNU find's -lname predicate, so we'd need something like:



      find /sys/devices -path '*/pci*/driver' -type l -exec readlink ; -print |
      awk -F/ -v OFS=/ '
      BEGINd["cb710"]d["r592"]d["r852"]d["rts5208"]d["rtsx_pci"]
      $NF in d
      getline
      NF--
      getline v < ($0 "/vendor")
      getline p < ($0 "/device")
      print substr(v, 3) ":" substr(p, 3)
      '


      There's no configuration file that we can use this time to determine the class of device (actually, there is a class file for the PCI device class, but I can see it being 0xff00 (Misc) for a Realtek device here, there is no PCI device class dedicate to "card readers" so we can't rely on it). So instead we look for drivers symlinks that point to any of the drivers known to be drivers for PCI card readers, and get the vendor/product IDs in paths relative to that.



      A simpler approach is to use /proc/bus/pci/devices:



      awk '
      BEGINd["cb710"]d["r592"]d["r852"]d["rts5208"]d["rtsx_pci"]
      $NF in d print substr($2, 1, 4) ":" substr($2, 5)
      ' < /proc/bus/pci/devices





      share|improve this answer
























        up vote
        3
        down vote



        accepted







        up vote
        3
        down vote



        accepted






        Card readers are often USB devices. If so, you could do something like:



        find /sys/devices -path '*/usb*/configuration' -exec 
        grep -lx 'CARD READER' + | awk -F/ -vOFS=/ '
        NF--
        getline idv < ($0 "/idVendor")
        getline idp < ($0 "/idProduct")
        getline v < ($0 "/manufacturer")
        getline p < ($0 "/product")
        print idv":"idp" "v" "p'


        To get vendor/product IDs and names (as reported by the kernel). That is look for USB devices whose configuration is set to CARD READER and extract the content of the vendorID, productID, manufacturer and product files located in the parent directory of the one containing the configuration file.



        For PCI devices, this would catch at least the devices using the drivers below. busybox find doesn't support GNU find's -lname predicate, so we'd need something like:



        find /sys/devices -path '*/pci*/driver' -type l -exec readlink ; -print |
        awk -F/ -v OFS=/ '
        BEGINd["cb710"]d["r592"]d["r852"]d["rts5208"]d["rtsx_pci"]
        $NF in d
        getline
        NF--
        getline v < ($0 "/vendor")
        getline p < ($0 "/device")
        print substr(v, 3) ":" substr(p, 3)
        '


        There's no configuration file that we can use this time to determine the class of device (actually, there is a class file for the PCI device class, but I can see it being 0xff00 (Misc) for a Realtek device here, there is no PCI device class dedicate to "card readers" so we can't rely on it). So instead we look for drivers symlinks that point to any of the drivers known to be drivers for PCI card readers, and get the vendor/product IDs in paths relative to that.



        A simpler approach is to use /proc/bus/pci/devices:



        awk '
        BEGINd["cb710"]d["r592"]d["r852"]d["rts5208"]d["rtsx_pci"]
        $NF in d print substr($2, 1, 4) ":" substr($2, 5)
        ' < /proc/bus/pci/devices





        share|improve this answer














        Card readers are often USB devices. If so, you could do something like:



        find /sys/devices -path '*/usb*/configuration' -exec 
        grep -lx 'CARD READER' + | awk -F/ -vOFS=/ '
        NF--
        getline idv < ($0 "/idVendor")
        getline idp < ($0 "/idProduct")
        getline v < ($0 "/manufacturer")
        getline p < ($0 "/product")
        print idv":"idp" "v" "p'


        To get vendor/product IDs and names (as reported by the kernel). That is look for USB devices whose configuration is set to CARD READER and extract the content of the vendorID, productID, manufacturer and product files located in the parent directory of the one containing the configuration file.



        For PCI devices, this would catch at least the devices using the drivers below. busybox find doesn't support GNU find's -lname predicate, so we'd need something like:



        find /sys/devices -path '*/pci*/driver' -type l -exec readlink ; -print |
        awk -F/ -v OFS=/ '
        BEGINd["cb710"]d["r592"]d["r852"]d["rts5208"]d["rtsx_pci"]
        $NF in d
        getline
        NF--
        getline v < ($0 "/vendor")
        getline p < ($0 "/device")
        print substr(v, 3) ":" substr(p, 3)
        '


        There's no configuration file that we can use this time to determine the class of device (actually, there is a class file for the PCI device class, but I can see it being 0xff00 (Misc) for a Realtek device here, there is no PCI device class dedicate to "card readers" so we can't rely on it). So instead we look for drivers symlinks that point to any of the drivers known to be drivers for PCI card readers, and get the vendor/product IDs in paths relative to that.



        A simpler approach is to use /proc/bus/pci/devices:



        awk '
        BEGINd["cb710"]d["r592"]d["r852"]d["rts5208"]d["rtsx_pci"]
        $NF in d print substr($2, 1, 4) ":" substr($2, 5)
        ' < /proc/bus/pci/devices






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Oct 2 '17 at 18:03

























        answered Oct 2 '17 at 13:12









        Stéphane Chazelas

        283k53522859




        283k53522859



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f395620%2fhow-do-i-get-the-type-of-internal-card-reader%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?