Monday, February 21, 2022

Setting Up Hamlib and CQRLOG with my FT-840 and Not-Ancient Laptop

 Setting Up Hamlib and CQRLOG with my FT-840

These are my notes.  I took them for my own use if I need to do this again, but if you find them usefule then good.  (I got much of this from other folks's notes, so thanks to them!)

Step 0) Get CQRLOG from its PPA.

CQRLOG wants you to get their stuff from their own repo.

sudo add-apt-repository ppa:ok2cqr/ppa;sudo apt-get update;sudo apt-get install cqrlog

Get hamlib.

sudo apt install libhamlib2

Get the signing software from the ARRL

 apt instalsudol trustedqsl

2) Add ke1az to the dialout group.

ke1az@ke1az-HP-Notebook:~$ sudo usermod -a -G dialout ke1az
[sudo] password for ke1az:

Step 1) Figure out how to connect to the rig.

The rig has a serial port, but no laptop made in this century does.  So I bought a USB-to-serial cord.  I must figure out how to connect it.  (This information is from http://pa0rob.vandenhoff.info/article/hamlib-rigcltd.  Thanks!).  From a terminal run

dmesg

then turn off radio, then turn it back on and run

dmesg

again.  You are looking for /dev/ttyUSB* messages

   15.088854] usbcore: registered new interface driver usbserial_generic
[   15.088875] usbserial: USB Serial support registered for generic
[   15.198003] usbcore: registered new interface driver ftdi_sio
[   15.198019] usbserial: USB Serial support registered for FTDI USB Serial Device
[   15.198090] ftdi_sio 1-3.4:1.0: FTDI USB Serial Device converter detected
[   15.198126] usb 1-3.4: Detected FT232RL
[   15.199949] usb 1-3.4: FTDI USB Serial Device converter now attached to ttyUSB0
[   15.226954] usbcore: registered new interface driver pl2303
[   15.226972] usbserial: USB Serial support registered for pl2303
[   15.226990] pl2303 1-1:1.0: pl2303 converter detected
[   15.227733] usb 1-1: pl2303 converter now attached to ttyUSB1

When plugging in your USB rig it will get mounted as /dev/ttyUSB0 or /dev/ttyUSB1 or ... The number depends on which other devices are plugged in and can vary after each reboot.  The udev system gives a device a name based on it's manufacturer and device ID. In Ubuntu, these rules are specified in

    /etc/udev/rules.d/

For hamlib devices, create a file named like this. 

  99-hamlib.rules

The 99- governs the order of execution within the udev startup.

Now, to find the rigs device:

~$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 064e:930b Suyin Corp. HP Truevision HD
Bus 001 Device 006: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 001 Device 005: ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 001 Device 003: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 001 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

In my case the sixth line is the Serial port. The VendorId:DeviceId is 067b:2303.

~$ ls -al /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Jan 22 13:29 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Jan 22 13:29 /dev/ttyUSB1

This gives /dev/ttyUSB0 and /dev/ttyUSB1 as the mounted serial devices.

Now we must find some attribute info for the devices to filter on in the udev rule.
The udevadm info starts with the device specified by the path and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
You can compose a rule to match using the attributes of the device
and the attributes from one single parent device.

~$  udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)
  looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4/1-3.4:1.0/ttyUSB0/tty/ttyUSB0':
    KERNEL=="ttyUSB0"
    SUBSYSTEM=="tty"
    DRIVER==""
  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4/1-3.4:1.0/ttyUSB0':
    KERNELS=="ttyUSB0"
    SUBSYSTEMS=="usb-serial"
    DRIVERS=="ftdi_sio"
    ATTRS{latency_timer}=="16"
    ATTRS{port_number}=="0"
  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4/1-3.4:1.0':
    KERNELS=="1-3.4:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="ftdi_sio"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceClass}=="ff"
    ATTRS{bNumEndpoints}=="02"
    ATTRS{bInterfaceSubClass}=="ff"
    ATTRS{bInterfaceProtocol}=="ff"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{authorized}=="1"
    ATTRS{interface}=="FT232R USB UART"
    ATTRS{supports_autosuspend}=="1"
  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4':
    KERNELS=="1-3.4"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{product}=="FT232R USB UART"
    ATTRS{tx_lanes}=="1"
    ATTRS{speed}=="12"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bMaxPower}=="90mA"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{urbnum}=="16"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{rx_lanes}=="1"
    ATTRS{maxchild}=="0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="FTDI"
    ATTRS{ltm_capable}=="no"
    ATTRS{idVendor}=="0403"
    ATTRS{quirks}=="0x0"
    ATTRS{configuration}==""
    ATTRS{version}==" 2.00"
    ATTRS{bDeviceClass}=="00"
    ATTRS{idProduct}=="6001"
    ATTRS{devnum}=="6"
    ATTRS{serial}=="A8007UXh"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bcdDevice}=="0600"
    ATTRS{devpath}=="3.4"
    ATTRS{bMaxPacketSize0}=="8"
    ATTRS{removable}=="unknown"
    ATTRS{busnum}=="1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="a0"
  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-3':
    KERNELS=="1-3"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{urbnum}=="40"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{rx_lanes}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bDeviceClass}=="09"
    ATTRS{idProduct}=="2812"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{maxchild}=="4"
    ATTRS{authorized}=="1"
    ATTRS{ltm_capable}=="no"
    ATTRS{devnum}=="3"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{configuration}==""
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{tx_lanes}=="1"
    ATTRS{idVendor}=="2109"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{devpath}=="3"
    ATTRS{busnum}=="1"
    ATTRS{bcdDevice}=="0be0"
    ATTRS{version}==" 2.10"
    ATTRS{product}=="USB2.0 Hub             "
    ATTRS{quirks}=="0x0"
    ATTRS{removable}=="removable"
    ATTRS{speed}=="480"
    ATTRS{manufacturer}=="VIA Labs, Inc.         "
  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bcdDevice}=="0511"
    ATTRS{authorized_default}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{version}==" 2.00"
    ATTRS{quirks}=="0x0"
    ATTRS{authorized}=="1"
    ATTRS{devpath}=="0"
    ATTRS{maxchild}=="8"
    ATTRS{busnum}=="1"
    ATTRS{configuration}==""
    ATTRS{devnum}=="1"
    ATTRS{product}=="xHCI Host Controller"
    ATTRS{tx_lanes}=="1"
    ATTRS{speed}=="480"
    ATTRS{manufacturer}=="Linux 5.11.0-34-generic xhci-hcd"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{ltm_capable}=="no"
    ATTRS{idProduct}=="0002"
    ATTRS{idVendor}=="1d6b"
    ATTRS{serial}=="0000:00:14.0"
    ATTRS{urbnum}=="60"
    ATTRS{rx_lanes}=="1"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{removable}=="unknown"
  looking at parent device '/devices/pci0000:00/0000:00:14.0':
    KERNELS=="0000:00:14.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="xhci_hcd"
    ATTRS{driver_override}=="(null)"
    ATTRS{d3cold_allowed}=="1"
    ATTRS{local_cpulist}=="0-3"
    ATTRS{dma_mask_bits}=="64"
    ATTRS{dbc}=="disabled"
    ATTRS{irq}=="43"
    ATTRS{device}=="0x9c31"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}=="1"
    ATTRS{numa_node}=="-1"
    ATTRS{vendor}=="0x8086"
    ATTRS{enable}=="1"
    ATTRS{consistent_dma_mask_bits}=="64"
    ATTRS{class}=="0x0c0330"
    ATTRS{revision}=="0x04"
    ATTRS{subsystem_device}=="0x80c3"
    ATTRS{power_state}=="D0"
    ATTRS{subsystem_vendor}=="0x103c"
    ATTRS{local_cpus}=="f"
    ATTRS{ari_enabled}=="0"
  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

Here is the other USB.

~$ udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB1)
  looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/ttyUSB1/tty/ttyUSB1':
    KERNEL=="ttyUSB1"
    SUBSYSTEM=="tty"
    DRIVER==""
  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/ttyUSB1':
    KERNELS=="ttyUSB1"
    SUBSYSTEMS=="usb-serial"
    DRIVERS=="pl2303"
    ATTRS{port_number}=="0"
  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0':
    KERNELS=="1-1:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="pl2303"
    ATTRS{supports_autosuspend}=="1"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bNumEndpoints}=="03"
    ATTRS{bInterfaceSubClass}=="00"
    ATTRS{bInterfaceProtocol}=="00"
    ATTRS{bInterfaceClass}=="ff"
    ATTRS{authorized}=="1"
    ATTRS{bAlternateSetting}==" 0"
  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-1':
    KERNELS=="1-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{ltm_capable}=="no"
    ATTRS{authorized}=="1"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{tx_lanes}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{maxchild}=="0"
    ATTRS{urbnum}=="21"
    ATTRS{devpath}=="1"
    ATTRS{idProduct}=="2303"
    ATTRS{product}=="USB-Serial Controller D"
    ATTRS{version}==" 1.10"
    ATTRS{devnum}=="2"
    ATTRS{speed}=="12"
    ATTRS{manufacturer}=="Prolific Technology Inc. "
    ATTRS{configuration}==""
    ATTRS{bcdDevice}=="0400"
    ATTRS{removable}=="removable"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{busnum}=="1"
    ATTRS{idVendor}=="067b"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bmAttributes}=="80"
    ATTRS{bMaxPower}=="100mA"
    ATTRS{quirks}=="0x0"
    ATTRS{rx_lanes}=="1"
    ATTRS{bDeviceSubClass}=="00"
  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{manufacturer}=="Linux 5.11.0-34-generic xhci-hcd"
    ATTRS{product}=="xHCI Host Controller"
    ATTRS{speed}=="480"
    ATTRS{devpath}=="0"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{authorized_default}=="1"
    ATTRS{version}==" 2.00"
    ATTRS{bcdDevice}=="0511"
    ATTRS{bDeviceClass}=="09"
    ATTRS{devnum}=="1"
    ATTRS{idProduct}=="0002"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{removable}=="unknown"
    ATTRS{tx_lanes}=="1"
    ATTRS{rx_lanes}=="1"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{urbnum}=="60"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{maxchild}=="8"
    ATTRS{bmAttributes}=="e0"
    ATTRS{busnum}=="1"
    ATTRS{ltm_capable}=="no"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{idVendor}=="1d6b"
    ATTRS{serial}=="0000:00:14.0"
    ATTRS{quirks}=="0x0"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{configuration}==""
    ATTRS{authorized}=="1"
  looking at parent device '/devices/pci0000:00/0000:00:14.0':
    KERNELS=="0000:00:14.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="xhci_hcd"
    ATTRS{subsystem_device}=="0x80c3"
    ATTRS{dbc}=="disabled"
    ATTRS{subsystem_vendor}=="0x103c"
    ATTRS{class}=="0x0c0330"
    ATTRS{power_state}=="D0"
    ATTRS{d3cold_allowed}=="1"
    ATTRS{enable}=="1"
    ATTRS{msi_bus}=="1"
    ATTRS{ari_enabled}=="0"
    ATTRS{device}=="0x9c31"
    ATTRS{broken_parity_status}=="0"
    ATTRS{numa_node}=="-1"
    ATTRS{vendor}=="0x8086"
    ATTRS{driver_override}=="(null)"
    ATTRS{local_cpus}=="f"
    ATTRS{revision}=="0x04"
    ATTRS{consistent_dma_mask_bits}=="64"
    ATTRS{irq}=="43"
    ATTRS{dma_mask_bits}=="64"
    ATTRS{local_cpulist}=="0-3"
  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

With those in mind, create and edit the rules file.

    sudo emacs /etc/udev/rules.d/99-ham_rig.rules

The .rules file looks like this (replace bold text with your rigs data)

    # FT-991A CP210x UART Bridge
    SUBSYSTEM=="tty", DRIVERS=="cp210x", ATTRS{interface}=="Standard*", SYMLINK+="rig1s"
    SUBSYSTEM=="tty", DRIVERS=="cp210x", ATTRS{interface}=="Enhanced*", SYMLINK+="rig1e"

Save that file and restart the udev service:

    sudo service udev restart
~$ sudo service udev restart
[sudo] password for ke1az: 

Load the new rule:

    sudo udevadm trigger

Check:

~$ ls -al /dev/rig*
lrwxrwxrwx 1 root root 7 Jan 22 14:42 /dev/rig1e -> ttyUSB1
lrwxrwxrwx 1 root root 7 Jan 22 14:42 /dev/rig1s -> ttyUSB0

~$ rigctld -m 111 -r /dev/rig1e -t 4532 -s 4800 --set-conf=data_bits=8, stop_bits=2, serial_parity=None, serial_handshake=None, dtr_state=OFF, rts_state=ON &
[1] 83876
ke1az@ke1az-HP-Notebook:~$ rig_open: error = IO error 
^C
[1]+  Exit 2                  rigctld -m 111 -r /dev/rig1e -t 4532 -s 4800 --set-conf=data_bits=8, stop_bits=2, serial_parity=None, serial_handshake=None, dtr_state=OFF, rts_state=ON
ke1az@ke1az-HP-Notebook:~$ rigctld -m 111 -r /dev/rig1s -t 4532 -s 4800 --set-conf=data_bits=8, stop_bits=2, serial_parity=None, serial_handshake=None, dtr_state=OFF, rts_state=ON &
[1] 83877
ke1az@ke1az-HP-Notebook:~$ rig_open: error = IO error 
^C
[1]+  Exit 2                  rigctld -m 111 -r /dev/rig1s -t 4532 -s 4800 --set-conf=data_bits=8, stop_bits=2, serial_parity=None, serial_handshake=None, dtr_state=OFF, rts_state=ON~$ ls -la /dev/ttyUSB1
crw-rw---- 1 root dialout 188, 1 Jan 22 14:42 /dev/ttyUSB1
ke1az@ke1az-HP-Notebook:~$ ls -la /dev/rig1e
lrwxrwxrwx 1 root root 7 Jan 22 14:42 /dev/rig1e -> ttyUSB1

Member of dialout group?

~$ grep dialout /etc/group
dialout:x:20:ke1az

Step 2) Getting ther Winkeyer to go.

In CQRLOG, use CQRLOG > Preferences > CW Interface.

Under Radio 1 use WinKeyer USB.  For the Radio 1 keyer port, disconnect from USB and connect back again.

[  762.711103] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[  762.711127] ftdi_sio 1-3.4:1.0: device disconnected
[  764.735666] usb 1-3.4: new full-speed USB device number 10 using xhci_hcd
[  764.853975] usb 1-3.4: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00
[  764.853982] usb 1-3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  764.853985] usb 1-3.4: Product: FT232R USB UART
[  764.853987] usb 1-3.4: Manufacturer: FTDI
[  764.853989] usb 1-3.4: SerialNumber: A8007UXh
[  764.861008] ftdi_sio 1-3.4:1.0: FTDI USB Serial Device converter detected
[  764.861063] usb 1-3.4: Detected FT232RL
[  764.861613] usb 1-3.4: FTDI USB Serial Device converter now attached to ttyUSB3

Use /dev/ttyUSB0 as the port under CW.

Wednesday, February 16, 2022

I guess Amazon is not interested.

I got an email from an annoyed user of my Linear Algebra text.  They had bought a paper copy and also bought a book of answers to the exercises.  The thing is, though, that the answers to exercises book that they bought, published by someone that I don't know, is from 2012.  So it doesn't match the 2022 version of the text.  That's why they wrote me, annoyed.

I explained that because the license is Free it allows people to do what they want with the work and in particular it allows someone to post the answers as a book on Amazon, and this person did just that, in 2012.  They haven't updated it.

I also went to Amazon and posted a user review for that book, explaining the situation, so a potential buyer would have a heads-up.  A couple of days later I got a notice from Amazon, saying this.

Thank you for submitting a customer review on Amazon. After carefully reviewing your submission, your review could not be posted to the website. It appears your content did not comply with our guidelines.

While we appreciate your time and comments, reviews must adhere to the following guidelines

Amazon Community Guidelines

from James S. Hefferon on February 12, 2022

THese are quite old

I am Jim Hefferon, the author of the Linear Algebra textbook. I am not the producer of this version so I cannot withdraw it. But please note that the text has new versions since these answers were produced, and these do not match the current text.

(My comment had more but they only included the first few sentences.)  They also gave a list of things I might have done wrong.  
A few common issues to keep in mind:
Your review should focus on specific features of the product and your experience with it. Feedback on the seller or your shipment experience should be provided at https://www.amazon.com/hz/feedback.
We do not allow profane or obscene content. This applies to adult products too.
Advertisements, promotional material or repeated posts that make the same point excessively are considered spam.
Please do not include URLs external to Amazon or personally identifiable content in your review.
Any attempt to manipulate Community content or features, including contributing false, misleading, or inauthentic content, is strictly prohibited.

Obviously this leaves a person taking a stab at precisely what is their objection.  OK, I'll stab.

Cearly I am focused on specific features of the product.  I did not get a shipment, so I'm not complaining about that.  I did not swear.  I did not contribute false or misleading content.  So they objected to my naming myself as the author?  

Crazy. 

Tuesday, January 11, 2022

What editor do you use for LaTeX?

 emacs

Does everything I want it to do. Been using it since the 80's and expect it will be there until I die. Is on every system I use or will likely ever use, either in a GUI form or in a terminal form, and probably in both forms. Has never, ever, lost or corrupted anything I ever wrote.

Saturday, September 11, 2021

Asymptote and opacity

 I am a terrible draw-er.  When I first started using computers, I got a tutorial for MS Paint, which wanted to walk me through drawing a picture of a magician's hat and wand.  "First use the Ellipse Tool to draw an ellipse" it said, and there was an accompanying picture.  I complied and got a pretty good copy.  "Now extend to get the body of the hat."  I could not.  No matter how many times I followed the steps, the body of the hat did not look right and I was unable to figure out how to change it to make it look like, you know, a hat body. In between my ears, where there ought to be a place to draw pictures, there is a gap.  A hole.  A yawing chasm.

I now rely on using systems where you say, "Put the camera at (10,5,4), point it at the origin, and show the extended elliptical surface."  This way, I am sure I get a good picture.  Specifically, I use AsymptoteIt is a programming language that outputs graphics, which are suitable for mathematics writing (including that it integrates with LaTeX).  One of its strengths is a great tutorial.

But all software has glitches and there has been an issue with opacity.  Opacity is partial transparency.  An example of using it is when you draw a plane in 3-space and you want see the axes when they are behind the plane.

Asymptote relies on Ghostscript as a back end, to handle the initial graphical output.  Some time ago, years ago, Ghostscript had a security issue affecting the Asymptote graphics that use opacity.  For a few years, the workaround was to call Asymptote with `asy -nosafe filename'.  No longer.  Here is part of a post I recently made to the Asymptote mailing list.

With this test.asy,

import settings;
settings.outformat="pdf";
settings.render=0;

unitsize(1pt);

draw((0,0)--(1,1), red+opacity(0.7));
// draw((0,0)--(1,1), red);

I get the GS failure

Loading test from test.asy
gs -q -dNOPAUSE -dBATCH -P -dALLOWPSTRANSPARENCY -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dEncodeColorImages=true -dEncodeGrayImages=true -dCompatibilityLevel=1.4 -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=3 -dDEVICEHEIGHTPOINTS=3 -sOutputFile=test.pdf test_.eps
Error: /undefined in .setfillconstantalpha
Operand stack:
   0.7
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1990   1   3   %oparray_pop   1989   1   3   %oparray_pop   1988   1   3   %oparray_pop   --nostringval--   1977   1   3   %oparray_pop   1833   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:739/1123(ro)(G)--   --dict:0/20(G)--   --dict:79/200(L)--
Current allocation mode is local
Current file position is 284
GPL Ghostscript 9.50: Unrecoverable error, exit code 1
  _shipout(prefix,f,currentpatterns,format,wait,view,t);
          ^
/usr/local/texlive/2021/texmf-dist/asymptote/plain_shipout.asy: 104.11: runtime: shipout failed

The error happens whether I use the -nosafe option or not. If I comment out the opacity-containing line and uncomment the other, then the error goes away and a correct .pdf comes out.

I recognized the `Error: /undefined in .setfillconstantalpha'.  My old nemesis is back.  Turns out, recently the Ghostscript people have implemented different operators to avoid the security issues.  So the option `-nosafe' no longer works, because you can't just ignore the security issues with the operators, since those operators are gone.  Instead, you have to worry about using specific versions of Ghostscript.  Yech. 

Anyway, the point of this post is to spread spread the word from the mailing list about the work-around.  (1) Download a known-good Ghostscript, as with gs 9.52 (watch out, 9.54 is back to not working, for instance).  Then for compiling with Asymptote, you can specify an alternate ghostscript location with settings.gs, or with the -gs command line option, or with the ASYMPTOTE_GS environment variable.  

Thanks to John and the other Asymptote folks for really useful software!