This topic contains 5 replies, has 3 voices, and was last updated by  cenicero 6 years, 3 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2107

    cenicero
    Member

    Hello,

    at the GCP project, where we’re testing the TrueRNG v3 cards at Linux (Raspebby Pi 3b), we’re having some trouble.

    While the DD+diehard test works succesfully, and it is created a /dev/TrueRNG device that works properly, we try to open the device in a C program with a line “r = usb_claim_interface(handle, 0);” and we get an error “-1″. It is dismaying. We have three questions:

    a) do you have any feedback or tip with this? How can we debug it?
    b) with the Araneus card works properly. I’ve tried to cheat the program so it should think the TrueRNG was an Araneus but didn’t work. Do you imagine any solution in this way?
    c) If not, we would be interested in simulate a COM or serial device with the TrueRNG, how can we do it? reading directly from /dev/TrueRNG?

    Thanks.

    #2108

    dgv
    Member

    Hello,

    You may open & read a TrueRNGv3 device via the

    Please refer to the msg “truerng library and program” posted on this forum.

    We use usb_claim_interface in file truerng_open.c

    Hope this helps,

    Denis/

    #2109

    dgv
    Member

    Correction on prev msg:

    the library “truerng-3.0″ is available at

    https://sites.google.com/site/hawksoftwarepackages/truerng

    Best regards,

    Denis/

    #2111

    Ubld.it Staff
    Moderator

    Ok let me see if I’m following here;

    usb_claim_interface sounds like is a libhid or libusb function. libusb lets you send raw usb urb’s from userland. Typically you would use libusb if a device had no kernel driver, or enumerated as a hid device just to satisfy the driver requirement but does the real work through special endpoint packets.

    So to answer a) I’m not sure what library you’re using, but -1 means it couldn’t claim it, probably because the linux driver has a hold of it. Typically you would have to unload the usb serial driver / cdc_acm driver to make the claim happen.

    which leads us to b) the Araneus Alea uses libusb to talk to the device, this isn’t needed with the Truerng.

    c) The TrueRNG is already a virtual com port. You can open it and treat it like a standard serial port (with open / serial open apis) or use the library above that dgv suggested.

    /dev/TrueRNG is a symlink to /dev/ttyACMx (x is 0-9) which is the same as a usb to serial connection.

    #2112

    dgv
    Member

    I confirm that usb_claim_interface is part of libusb.

    What makes things fuzzy is that cenicero explicitly refers to /dev/TrueRNG, which is typically created by udev(7) on Linux.
    It is then probable that libudev is installed on the system. Check with “pkg-config –cflags –libs libudev”.
    If present, then using libusb is questionable; use libudev instead, or open directly /dev/TrueRNG for reading.
    BTW, the configure script from the above library installation process chooses the best available method for opening/reading.

    brgds,
    Denis/

    #2113

    cenicero
    Member

    Thank you. The fact that TrueRNG v3 can be read as a serial device helped a lot. I have written an article about how to use a TrueRNG with the GCP at this link:

    https://gacimartin.com/2017/12/10/creating-an-gcp-egg-node-with-a-raspberry-pi-and-a-truerng-hardware-random-number-generator/

    Thanks for your quick and deep support.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.