Ed

By turns: tinker, engineer, husband, author, amateur raconteur, recumbent cyclist, father, ham radio geek. So many projects, so little time!

Homepage: http://softsolder.com

HP 7475A Plotter Data Sniffing: socat Serial Port Tee

Some hints and examples provided the socat incantation required to sniff serial data between my Superformula demo program (on the Raspberry Pi) and my HP 7475A plotter:

socat /dev/ttyUSB0,raw,echo=0 SYSTEM:'tee /tmp/in.txt | socat - "PTY,link=/tmp/ttyv0,raw,echo=0,wait-slave" | tee /tmp/out.txt'

The out.txt file collects data from the program to the plotter, the in.txt file holds data from the plotter to the program, and both files contain exactly and only the serial data, so some interpretation will be required.

With that in hand, tweak the .chiplotle/config.py file to aim Chiplotle at the virtual serial port:

serial_port_to_plotter_map = {'/tmp/ttyv0' : 'HP7475A'}

This is dramatically easier than wiring a pair of additional hardware serial ports onto the RS-232 connection between the two:

HP 7475A - serial port adapters - hardcore
HP 7475A – serial port adapters – hardcore

The adapter stack instantly become a custom cable, although I miss Der Blinkenlights.

The HPGL output to the plotter (out.txt) comes from the Chiplotle driver with no embedded linefeed / carriage return characters, as HPGL uses semicolon command terminators, making it one humongous line impervious to the usual text utilities. In addition, several plotter configuration commands have prefix ESC (0x1b) characters without semicolon separators. Each LB (label) command within the stream ends with a 0x03 ETX character.

While one could fix all those gotchas with a sufficiently complex sed script, I manually separated the few lines I needed after each semicolon, then converted the raw ASCII control characters to displayable Unicode glyphs (␛ and ␃), making it legible for a presentation:

head -c 1000 out.txt
␛.B
␛.(;
IN;
OW;OW;OW;OW;
␛.H200:;
SC;
OW;OW;OW;OW;
IP0,0,16640,10365;
OW;OW;
SC-8320,8320,-5182,5182;
SI0.13,0.17;
VS8;
PA5320,-4282;
SP1;
PA5320,-4282;
LBStarted 2020-01-09 18:03:57.494617␃;
SP1;
PA5320,-4382;
LBPen 1: ␃;
SP1;
LBm=1.9 n1=0.71 n2=n3=0.26␃;
SP1;
PU;
PA8320.00,0.00;
PD;
PA8320.00,0.00,
6283.71,24.59,
5980.63,46.81,
5789.79,67.98,
5648.37,88.44,
5535.22,108.34,
5440.50,127.81,
5358.77,146.89,
<<< snippage >>>

The corresponding responses from the plotter to the program (in.txt) are separated by carriage return characters (␍) with no linefeeds (␊), so the entire file piles up at the terminal’s left margin when displayed with the usual text tools. Again, manually splitting the output at the end of each line produces something useful:

1024
0,0,16640,10365
0,0,16640,10365
0,0,16640,10365
0,0,16640,10365
0,0,16640,10365
0,0,16640,10365
0,0,16640,10365
0,0,16640,10365
0,0,16640,10365
0,0,16640,10365
26
18
18
<<< snippage >>>

The first number gives the size of the serial FIFO buffer. An inexplicable ten OW; commands from deep in the Chiplotle driver code return the Output Window size in plotter units. No other commands produce any output until the plot finishes, whereupon my code waits for a digitized point from the plotter, with the (decimal) 18 indicating a point isn’t ready.

All that at 9600 bits per second …

Leave a comment

Schwab / Symantec VIP Access vs. Yubikey

A Yubikey 5 NFC turns out to be perfectly compatible with any website using Symantec’s (no longer available) hardware key and VIP Access (definitely a misnomer) app to generate TOTP access codes, because the sites use bog-standard TOTP. The only difficulty comes from Symantec’s proprietary protocol creating the token linking an ID with a secret value to generate the TOTP codes, which is how they monetize an open standard.

Fortunately, Cyrozap reverse-engineered the Symantec protocol, dlenski mechanized it with a Python script, and it works perfectly:

python3 -m venv symkey-env
source symkey-env/bin/activate
pip3 install https://github.com/dlenski/python-vipaccess/archive/HEAD.zip
vipaccess provision -t SYMC
deactivate

That spits out a file containing the ID and secret, from which you create a QR code for the Yubikey Authenticator app:

qrencode -t UTF8 'otpauth://totp/VIP%20Access:SYMCidnumbers?secret=longsecretgibberish&issuer=Symantec&algorithm=SHA1&digits=6'

Fire up the app, wave the Yubikey behind the phone, scan the QR code, wave the Yubikey again to store it, sign in to the Schwab site, turn on 2FA, enter the ID & current TOTP value from the Yubikey Authenticator, and It Just Works™.

Of course, you can kiss Schwab’s tech support goodbye, because you’re on your own. If you ever lose the Yubikey, make sure you know the answers to your allegedly secret questions.

Equally of course, you’re downloading and running random shit from the Intertubes, but …

Now, if only all my financial institutions would get with the program.

, ,

Leave a comment

Monthly Image: Digital Machinist 14.4 Cover

I ain’t getting richer, but I did get mah pitcher onna cover of th’ Digital Machinist:

Digital Machinist Cover DM14.4 - Winter 2019
Digital Machinist Cover DM14.4 – Winter 2019

I just caught George Bulliss in a weak moment. [grin]

It’s the diamond drag holder on the CNC 3018-Pro, before the XL axis extension hackage., with the probe camera stuck to the left side.

You can say you knew me before …

,

2 Comments

Huion H610Pro (V2) Tablet vs. xsetwacom

For unknown reasons, likely having to do with ordinary system updates, both the Huion H610Pro (V2) tablet’s device name and the display output’s name have changed. This came to light when I discovered the tablet’s stylus was no longer constrained to the landscape display, which worked fine when I set it up barely a month ago.

Running the setup command manually:

xsetwacom --verbose set "HUION Huion Tablet Pen stylus" MapToOutput "DP-1"
... Display is '(null)'.
... 'set' requested for 'HUION Huion Tablet Pen stylus'.
 <<< snippage >>>
... Checking device 'HUION Huion Tablet stylus' (11).
... Checking device 'HUION Huion Tablet eraser' (19).
Cannot find device 'HUION Huion Tablet Pen stylus'.

Apparently, the device formerly known as HUION Huion Tablet Pen stylus is now called HUION Huion Tablet stylus.

Fine, I can live with that. Try again:

xsetwacom --verbose set "HUION Huion Tablet stylus" MapToOutput "DP-1"
... Display is '(null)'.
... 'set' requested for 'HUION Huion Tablet stylus'.
 <<< snippage >>>
... Checking device 'HUION Huion Tablet stylus' (11).
... Checking device 'HUION Huion Tablet eraser' (19).
... Device 'HUION Huion Tablet stylus' (11) found.
... Found output 'VGA-1' (disconnnected)
... Found output 'DP-1' (disconnnected)
... Found output 'HDMI-1' (disconnnected)
... Found output 'DP-2' (connected)
... CRTC (2560x0) 1440x2560
... Found output 'HDMI-2' (disconnnected)
... Found output 'DP-1-8' (connected)
... CRTC (0x0) 2560x1440
... Found output 'DP-1-1' (disconnnected)
Unable to find output 'DP-1'. Output may not be connected.

Apparently, the video output formerly known as DP-1 has fissioned into DP-1-1 and DP-1-8, with only the latter connected. Weirdly, nothing happened to DP-2.

Once more, into the bleach:

xsetwacom --verbose set "HUION Huion Tablet stylus" MapToOutput "DP-1-8"
... Display is '(null)'.
... 'set' requested for 'HUION Huion Tablet stylus'.
 <<< snippage >>>
... Checking device 'HUION Huion Tablet stylus' (11).
... Checking device 'HUION Huion Tablet eraser' (19).
... Device 'HUION Huion Tablet stylus' (11) found.
... Found output 'VGA-1' (disconnnected)
... Found output 'DP-1' (disconnnected)
... Found output 'HDMI-1' (disconnnected)
... Found output 'DP-2' (connected)
... CRTC (2560x0) 1440x2560
... Found output 'HDMI-2' (disconnnected)
... Found output 'DP-1-8' (connected)
... CRTC (0x0) 2560x1440
... Setting CRTC DP-1-8
... Remapping to output area 2560x1440 @ 0,0.
... Transformation matrix:
... 	[ 0.640000 0.000000 0.000000 ]
... 	[ 0.000000 0.562500 0.000000 ]
... 	[ 0.000000 0.000000 1.000000 ]

Well, that worked.

Actually, I had to constrain the stylus to DP-2, then jam it back on DP-1-8, to spread the tablet’s horizontal extent over the entire monitor. Updating the startup script started the tablet properly the next morning.

The new device name certainly makes more sense and, perhaps, the X output connection now recognizes the landscape monitor’s ability to pass its DisplayPort video stream along to a second monitor.

,

Leave a comment

Blackburn Flea Bike Headlight

A Blackburn Flea bike headlight and its USB charger emerged from the packs on our Young Engineer’s Tour Easy, but the battery was completely defunct. With nothing to lose, I applied a small screwdriver to crack the case:

Blackburn Flea - opening case
Blackburn Flea – opening case

The battery is a single cylindrical lithium cell:

Blackburn Flea - battery
Blackburn Flea – battery

The USB charger seemed defunct, as it produced only a few dozen millivolts when connected and plugged into its wall wart. Cracking its case revealed a tiny buck power supply with no obvious damage, but also no output.

So I manually charged the cell:

Blackburn Flea - external recharge
Blackburn Flea – external recharge

Definitely not recommended practice, but a bench supply set to 4.1 V and current-limited to 100 mA gets the job done: the current stays at 100 mA while the voltage rises to 4.1 V, then the current drops to just about zero over the next few hours with cell held at 4.1 V.

Unfortunately, the cell really was defunct, even after a few cycles, so I conjured a not-dead-yet lithium cell from the heap:

Blackburn Flea - measurement setup
Blackburn Flea – measurement setup

Given a good supply, the Flea still works perfectly:

Blackburn Headlight - Kyocera Li-ion - 50 mA-div
Blackburn Headlight – Kyocera Li-ion – 50 mA-div

The yellow trace shows the battery holding at 4 V while the LED current runs at 150 mA (3 div × 50 mA/div). You wouldn’t want to run ordinary 5 mm LEDs at nearly 40 mA, but Blackburn surely specified good parts.

Replacing the Flea’s internal cell seems impossible, given its peculiar form factor, and grafting the PCB to an external cell makes no sense, given that it’d then need a custom bike mount.

So another chunk of electronics goes in the e-waste box.

Ride on!

2 Comments

Needle Case Repair

A needle case emerged from the bottom of a drawer in need of repair:

Needle Case - unglued
Needle Case – unglued

The original joint used solvent glue and I suppose I could refresh it with acetone, but two blobs of hot melt glue seemed easier and, IMO, more durable.

In any event, it’s once more ready for use:

Needle Case - repaired
Needle Case – repaired

Hooray for another zero-dollar repair, although you can see why nobody else does them these days.

, ,

Leave a comment

Alkaline Battery Packaging

Apparently, we’ve burned enough cargo aircraft and killed enough people to require careful attention to detail in battery packages:

Amazon alkaline AAA packaging
Amazon alkaline AAA packaging

These “Ships from and sold by Amazon” alkaline AA cells arrived by UPS. They now fall under reasonable requirements to prevent shorting and damage, although the cardboard box wasn’t sturdy enough to prevent them from breaking free laterally.

One might quibble about the “Health & Personal Care Item” description, but, yeah, better battery packaging seems like a good idea.

2 Comments