Skip to content

Instantly share code, notes, and snippets.

@jj1bdx
Last active May 26, 2021 15:47
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jj1bdx/0d9eb3d2b2783c0c60f6 to your computer and use it in GitHub Desktop.
Save jj1bdx/0d9eb3d2b2783c0c60f6 to your computer and use it in GitHub Desktop.
How to enable NeuG on OS X and FreeBSD (by ejecting the Fraucheky drive)
// put this file as /usr/local/etc/devd/neug-fraucheky.conf
attach 101 {
device-name "umass[0-9]+";
match "vendor" "0x234b";
match "product" "0x0004";
action
"/usr/sbin/usbconfig -d $ugen add_quirk UQ_MSC_FORCE_PROTO_UFI";
};

How to enable NeuG on OS X and FreeBSD

Executive summary

  • Eject the Fraucheky drive to enable NeuG
  • On FreeBSD, you need to set the usbconfig add_quirk UQ_MSC_FORCE_PROTO_UFI for the device

Ejecting Fraucheky drive needed to enable NeuG

NeuG uses Fraucheky, a filesystem container which enforces users to view certain files such as the terms of license.

To enable NeuG, the mounted Fraucheky filesystem must be ejected. This procedure is, however, not trivial for non-Linux users.

On OS X

On OS X (tested on 10.10.4 Yosemite), you need to eject the drive. Here's a command line example:

kenji% diskutil list
[... snip ...]
/dev/disk3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            Fraucheky              *65.5 KB    disk3
kenji% diskutil eject disk3
Disk disk3 ejected

Then you can see the USB ACM device for NeuG as follows:

kenji% ls -l /dev/cu.*
crw-rw-rw-  1 root  wheel   17,  45 Jul 22 21:43 /dev/cu.usbmodem1d11331

On FreeBSD

Note: a devd.conf script neug-fraucheky.conf is available in this Gist. Install the file at /usr/local/etc/devd/ and restart devd by service devd restart, then the quirk will be automatically added.

On FreeBSD 10-STABLE, you cannot mount the Fraucheky drive, due to some quirks, as follows:

umass0: at uhub2, port 7, addr 3 (disconnected)
umass0: <Free Software Initiative of Japan Fraucheky, class 0/0, rev 1.10/1.00, addr 3> on usbus1
umass0:  SCSI over Bulk-Only; quirks = 0x010c
umass0:2:0:-1: Attached to scbus2
(probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00 00
(probe0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(probe0:umass-sim0:0:0:0): Retrying command
(probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00 00
(probe0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(probe0:umass-sim0:0:0:0): Retrying command
(probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00 00
(probe0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(probe0:umass-sim0:0:0:0): Retrying command
(probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00 00
(probe0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(probe0:umass-sim0:0:0:0): Retrying command
(probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00 00
(probe0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(probe0:umass-sim0:0:0:0): Retrying command
(probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00 00
(probe0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(probe0:umass-sim0:0:0:0): Error 5, Retries exhausted
(da0:umass-sim0:0:0:0): got CAM status 0x44
(da0:umass-sim0:0:0:0): fatal error, failed to attach to device

You need to fix the quirks as follows, for the ugen1.3 device of NeuG (see the usbconfig add_quirk command):

# usbconfig -u 1 -a 3
ugen1.3: <Fraucheky Free Software Initiative of Japan> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
# usbconfig -u 1 -a 3 add_quirk UQ_MSC_FORCE_PROTO_UFI
# usbconfig -u 1 -a 3 power_off
# usbconfig -u 1 -a 3 power_on

Then you will get in dmesg output:

da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <FSIJ Fraucheky 1.0> Removable Direct Access SPC-3 SCSI device
da0: Serial Number FSIJ-0.0
da0: 1.000MB/s transfers
da0: 0MB (128 512 byte sectors: 64H 32S/T 0C)
da0: quirks=0x2<NO_6_BYTE>

Ejecting the mounted device will enable the NeuG device, as in the following dmesg output:

# camcontrol eject da0
Unit stopped successfully, Media ejected
# dmesg
[ ... snip ...]
ugen1.3: <Free Software Initiative of Japan> at usbus1 (disconnected)
umass0: at uhub2, port 7, addr 3 (disconnected)
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <FSIJ Fraucheky 1.0> s/n FSIJ-0.0 detached
(da0:umass-sim0:0:0:0): Periph destroyed
ugen1.3: <Free Software Initiative of Japan> at usbus1
umodem0: <Free Software Initiative of Japan NeuG True RNG, class 2/0, rev 1.10/1.00, addr 3> on usbus1
umodem0: data interface 1, has CM over data, has no break

And the modem device shows up as follows:

# ls -ltr /dev/cua*
crw-rw----  1 uucp  dialer  0x93 Jul 22 23:05 /dev/cuaU0
crw-rw----  1 uucp  dialer  0x94 Jul 22 23:05 /dev/cuaU0.init
crw-rw----  1 uucp  dialer  0x95 Jul 22 23:05 /dev/cuaU0.lock
@jj1bdx
Copy link
Author

jj1bdx commented Jul 25, 2015

Note: UQ_MSC_NO_INQUIRY also works as well as UQ_MSC_FORCE_PROTO_UFI.

@jj1bdx
Copy link
Author

jj1bdx commented Jul 25, 2015

Note again: UQ_MSC_FORCE_PROTO_RBC also worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment