# Flying Stone Tiny 01G



## stimi (Apr 26, 2020)

Hello,

I bought a TRNG after reading about some issues with Intel RNG. I grabbed a FST-01G from the FSF a while back and have not had any luck getting it to work in FreeBSD. In Debian I am able to eject the device node (e.g. /dev/sdb) and have it attach to /dev/ttyAMA0 instantly, which allows me to read from serial. (This is just to confirm that it works, I was intending to use this in a FreeBSD server environment, not GNU/Linux).

This is what the buffer reads when I plug it in:

```
ugen0.2: <Free Software Initiative of Japan Fraucheky> at usbus0
umass0 on uhub2
umass0: <Free Software Initiative of Japan Fraucheky, class 0/0, rev 1.10/2.00, addr 2> on usbus0
umass0: SCSI over Bulk-Only; quirks = 0x0100
umass0:3:0: Attacjed to scbus3
(da0:umass-sim0:0:0:0): got CAM status 0x44
(da0:umass-sim0:0:0:0): fatal error, failed to attach to device
g_access(944): provider da0 has error 6 set
g_access(944): provider da0 has error 6 set
g_access(944): provider da0 has error 6 set
g_access(944): provider da0 has error 6 set
```

Is there a way I can skip attaching as a storage device and just open serial connection to this device?

Edit: This is FreeBSD 12.1 Release


----------



## stimi (Apr 27, 2020)

I found this in the handbook: https://www.freebsd.org/cgi/man.cgi?query=usbconfig
Which has kind of moved me in the right direction. I see that it is trying to load with the umass driver. I see that there are templates that have different options for programming, like 0 (storage), or 3(usb serial), and I am also able to dump the device descriptions, but I do not yet know enough about USB to really know what I am looking at:


```
ugen0.3: <Free Software Initiative of Japan Fraucheky> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0110
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x234b
  idProduct = 0x0004
  bcdDevice = 0x0200
  iManufacturer = 0x0001  <Free Software Initiative of Japan>
  iProduct = 0x0002  <Fraucheky>
  iSerialNumber = 0x0003  <FSIJ-0.0>
  bNumConfigurations = 0x0001

Configuration index 0

    bLength = 0x0009
    bDescriptorType = 0x0002
    wTotalLength = 0x0020
    bNumInterfaces = 0x0001
    bConfigurationValue = 0x0001
    iConfiguration = 0x0000  <no string>
    bmAttributes = 0x0080
    bMaxPower = 0x0032

    Interface 0
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0000
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0002
      bInterfaceClass = 0x0008  <Mass storage>
      bInterfaceSubClass = 0x0006
      bInterfaceProtocol = 0x0050
      iInterface = 0x0000  <no string>

     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0086  <IN>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0040
        bInterval = 0x0000
        bRefresh = 0x0000
        bSynchAddress = 0x0000

     Endpoint 1
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0006  <OUT>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0040
        bInterval = 0x0000
        bRefresh = 0x0000
        bSynchAddress = 0x0000
```

I tried the *set*_*config *option to 3 since the template had said 3 but it did not work.

EDIT:
I found this package:





						usb_modeswitch
					






					www.freebsd.org
				



I'm going to work on a config and post results.


----------

