The Smell of Molten Projects in the Morning

Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.

Category: PC Tweakage

Remembering which tweaks worked

  • Scrubbing Old Hard Drives

    The shelf that collects old hard drives filled up, so I’ve been wiping the data before recycling them. This takes a while, but we know what happens when your hardware falls into unexpected hands. The routine goes a little something like this…

    Set the drive’s jumper to Master, plug the drive into the USB adapter, plug the adapter directly into a USB port on the PC (because outboard hubs tend to be flaky), make sure there’s no valuable data, unmount.

    time sudo dd if=/dev/urandom of=/dev/sdc bs=4096
    [sudo] password for ed: 
    dd: error writing ‘/dev/sdc’: No space left on device
    73259047+0 records in
    73259046+0 records out
    300069052416 bytes (300 GB) copied, 22276.7 s, 13.5 MB/s
    
    real	371m19.003s
    user	0m22.884s
    sys		370m34.906s 

    Good old dd works for me; the only trick is not obliterating the system’s main hard drive with a simple finger fumble. Numbers from /dev/urandom suffice for this purpose; that’s where most of the packaged programs get their data, too. I do hardcore style, just because.

    Ordinary desktop drives, at least those from long ago, can write at a bit over 12 MB/s → 40 GB/h on the average, with the higher peak rates that generally appear in the drive descriptions remaining an occasional sight. They won’t go much faster, even when plugged directly into the system board, but it’s not as if I sit there waiting until it’s done. USB 2.0 “high speed” transfers can hit 60 MB/s, including all the overhead, so that’s not the limiting factor; I’d expect the adapter’s firmware to throttle the data long before the bus strangles.

    Use gparted to write a fresh partition table with a single NTFS (because the next user will probably run Windows) partition labeled Scrubbed spanning the entire drive.

    Then stack the drive neatly on the outbound heap:

    Scrubbed hard drives
    Scrubbed hard drives

    That cardboard box isn’t quite as full of unscrubbed drives as it was a few weeks ago.

    The stack in the back contains all those worthless 30 to 80 GB 5400 RPM drives from old Dells, plus a few 1.5 and 2.0 (!) GB drives from who knows where. I have a plan for those platters…

  • Testing USB Memory Devices

    Tantris recommended the f3 set of programs to verify USB memory devices, which certainly seemed as though it would be faster and much less labor-intensive than my low-tech manual method.

    Compiling it from source required installing two dependencies, which I discovered by the simple expedient of iteratively smashing into “fatal error: parted/parted.h: No such file or directory” messages:

    • libudev-dev
    • libparted0-dev

    With those in place, unleashing f3probe on the most recent replacement Sony 64 GB MicroSD card went swimmingly:

    sudo ./f3probe --time-ops /dev/sdb
    F3 probe 5.0
    Copyright (C) 2010 Digirati Internet LTDA.
    This is free software; see the source for copying conditions.
    Please unplug and plug back the USB drive. Waiting... Thanks
    Please unplug and plug back the USB drive. Waiting... Thanks
    Please unplug and plug back the USB drive. Waiting... Thanks
    Please unplug and plug back the USB drive. Waiting... Thanks
    Please unplug and plug back the USB drive. Waiting... Thanks
    Please unplug and plug back the USB drive. Waiting... Thanks
    CAUTION		CAUTION		CAUTION
    No more resets are needed, so do not unplug the drive
    Probe finished, recovering blocks... Done
    
    Good news: The device `/dev/sdb' is the real thing
    
    Device geometry:
    	        *Real* size: 60.37 GB (126613504 blocks)
    	     Announced size: 60.37 GB (126613504 blocks)
    	             Module: 64.00 GB (2^36 Bytes)
    	Physical block size: 512.00 Byte (2^9 Bytes)
    
    Probe time: 61.19 seconds
    Probe read op: count=775, total time=4.00s, avg op time=5.16ms
    Probe write op: count=753, total time=3.77s, avg op time=5.00ms
    Probe reset op: count=6, total time=53.42s, avg op time=8903.21ms
    

    As predicted, most of the time passed while I fiddled with the SD Card adapter in the slot on the side of the U2711 monitor: push to release, push to insert, repeat as prompted.

    Despite the f3fix program’s ability to “repair” counterfeit USB memory by resetting the partition to the actual capacity, I think that’s a Bad Idea. Based on my admittedly limited experience, counterfeit junk generally doesn’t come from the middle of the quality-control bell curve, so expecting that crap to actually work over the long term seems, shall we say, overconfident.

    The f3 doc also told me about lsblk, which may come in handy every now & again:

    lsblk
    NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    sda      8:0    0 111.8G  0 disk 
    ├─sda1   8:1    0  56.8G  0 part /
    └─sda2   8:2    0   9.3G  0 part [SWAP]
    sdb      8:16   1  60.4G  0 disk 
    └─sdb1   8:17   1  60.4G  0 part /media/ed/9C33-6BBD
    sr0     11:0    1  1024M  0 rom 
    

    Now I have a reminder of how to do this for The Next Time…

  • Presentation Video: Bring Enough Adapters

    I plugged my trusty Dell Latitude E6410 into the VGA cable connected to a Viewsonic projector at TechShop Detroit to give the OpenSCAD Modeling presentation, but the display showed a surprising amount of ghosting; whether that was due to a bad cable or the usual presentation gremlins, I cannot say. Fortunately, although I didn’t have a VGA cable, I did have a fair assortment of adapters for the laptop’s DisplayPort output…

    On the laptop end, DisplayPort to a DVI-D cable:

    Latitude vs Viewsonic - DisplayPort to DVI-D
    Latitude vs Viewsonic – DisplayPort to DVI-D

    On the Viewsonic end, DVI-D to HDMI:

    Latitude vs Viewsonic - DVI-D to HDMI
    Latitude vs Viewsonic – DVI-D to HDMI

    Worked like a champ!

    The projector in the room for the Arduino Survival Guide presentation had a VGA cable, but had been losing sync and turning itself off, so I unplugged that, rebuilt the DisplayPort adapter string, and continued the mission.

    I must add a known-good VGA cable and corresponding adapters to the assortment…

  • No Affordance for Pulling

    Well, I didn’t expect this:

    Unsleeved USB memory
    Unsleeved USB memory

    Turns out the only thing holding that case in place was a blob of hot-melt glue on the bottom of the PCB. Hot-melt glue doesn’t bond well to anodized aluminum, the RPi had been sitting outside on a winter day taking time-lapse bird feeder pictures, and the USB connector seemed a bit more snug than usual.

    So I slobbered more hot-melt glue on the end of the PCB, jammed the case back in place, and that was that.

    The PCB has two snap lines to accommodate shorter cases, with corresponding activity LED locations; it seems I got the long-case version.

  • Rebooting a Dell U2711 Monitor

    It turns out my fancy Dell U2711 landscape monitor doesn’t work well with Displayport video. I normally leave it in power-save mode, with the power LED slowly fading orange, but about once a week it won’t start up when I turn on the PC. It seems the only solution is a hard power cycle, so I plugged it into a remotely switched outlet to eliminate having to pull its plug.

    Now that I know what to watch for, it’s easy to work around: if the power LED doesn’t turn blue when the PC power goes on, immediately turn off the PC power and power-cycle the U2711. If I let the PC continue in Xubuntu, the U2713 portrait monitor becomes the primary display and X helpfully rearranges the video configuration around the disabled U2711 until I manually un-wedge things. If I shut down the PC while it’s still displaying the BIOS intro screen, then click-click the remote power switch, the U2711 will be good for another week or so.

    Every month or so, the U2711 won’t light up after going into power-save mode, even though the PC is still running just fine. I set Lightlocker (which replaces the classic screensaver on Xubuntu) to blank the screen after 10 minutes and turn off the display power after 11 minutes. When the U2711 doesn’t light up, some delicate xrandr surgery through the U2713 will bring the U2711 back to life.

    The starting situation looks like this:

    xrandr
    Screen 0: minimum 8 x 8, current 1440 x 2560, maximum 16384 x 16384
    DP-0 disconnected primary (normal left inverted right x axis y axis)
    DP-1 disconnected (normal left inverted right x axis y axis)
    DP-2 connected (normal left inverted right x axis y axis)
       2560x1440      60.0 +
       1920x1200      59.9  
       1920x1080      60.0     59.9     50.0     24.0     60.1     60.0     50.0  
       1680x1050      60.0  
       1600x1200      60.0  
       1280x1024      75.0     60.0  
       1280x800       59.8  
       1280x720       60.0     59.9     50.0  
       1152x864       75.0  
       1024x768       75.0     60.0  
       800x600        75.0     60.3  
       720x576        50.0     50.1  
       720x480        59.9     60.1  
       640x480        75.0     59.9     59.9  
    DP-3 connected 1440x2560+0+0 left (normal left inverted right x axis y axis) 597mm x 336mm
       2560x1440      60.0*+
       1920x1200      59.9  
       1920x1080      60.0     59.9     50.0     24.0     60.1     60.0     50.0  
       1680x1050      60.0  
       1600x1200      60.0  
       1280x1024      75.0     60.0  
       1280x800       59.8  
       1280x720       60.0     59.9     50.0  
       1152x864       75.0  
       1024x768       75.0     60.0  
       800x600        75.0     60.3  
       720x576        50.0     50.1  
       720x480        59.9     60.1  
       640x480        75.0     59.9     59.9
    

    Note that there’s no asterisk on DP-2’s 2650x1440 entry, which means it’s not active. In fact, it’s jammed in power-save mode and nothing other than a hard power cycle will wake it up.

    The U2713 portrait monitor wakes up just fine, so X piles all the program windows into an untidy heap on that display, but, with enough Alt-Tab action, I can eventually resurface the console window and start typing:

    xrandr --output DP-2 --off
    xrandr --output DP-2 --auto
    xrandr --output DP-3 --right-of DP-2
    

    The DP-2 and DP-3 outputs correspond to what xrandr reported above.

    Then I must rearrange all the windows on both monitors again, but that’s much easier than the hocus-pocus required to recover after rebooting the PC with the U2711 shut down.

    The normal (or recovered) video situation looks like this:

    xrandr
    Screen 0: minimum 8 x 8, current 4000 x 2560, maximum 16384 x 16384
    DP-0 disconnected primary (normal left inverted right x axis y axis)
    DP-1 disconnected (normal left inverted right x axis y axis)
    DP-2 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
       2560x1440      60.0*+
       1920x1200      59.9  
       1920x1080      60.0     59.9     50.0     24.0     60.1     60.0     50.0  
       1680x1050      60.0  
       1600x1200      60.0  
       1280x1024      75.0     60.0  
       1280x800       59.8  
       1280x720       60.0     59.9     50.0  
       1152x864       75.0  
       1024x768       75.0     60.0  
       800x600        75.0     60.3  
       720x576        50.0     50.1  
       720x480        59.9     60.1  
       640x480        75.0     59.9     59.9  
    DP-3 connected 1440x2560+2560+0 left (normal left inverted right x axis y axis) 597mm x 336mm
       2560x1440      60.0*+
       1920x1200      59.9  
       1920x1080      60.0     59.9     50.0     24.0     60.1     60.0     50.0  
       1680x1050      60.0  
       1600x1200      60.0  
       1280x1024      75.0     60.0  
       1280x800       59.8  
       1280x720       60.0     59.9     50.0  
       1152x864       75.0  
       1024x768       75.0     60.0  
       800x600        75.0     60.3  
       720x576        50.0     50.1  
       720x480        59.9     60.1  
       640x480        75.0     59.9     59.9
    

    Note that DP-2 now sports an asterisk.

    The width of Screen 0 covers the U2711 in landscape and the U2713 in portrait: 4000 = 2560+1440. The height comes from the U2713 in portrait mode: 2560.

    That this should not be necessary goes without saying. The U2711 run with firmware revision A09, which was supposed to fix the problem, but Dell basically walked away from it.

    I’m pretty much forced to use Displayport video for both monitors, as a low-profile nVidia card with two dual-link DVI-D outputs doesn’t seem to exist. The Dell Optiplex 980 disables the system board video when it finds a PCI-E video card, so there’s no way to run the U2713 from the system board Displayport and the U2711 from a dual-link DVI PCI-E video card.

  • HP 7475A Plotter: Serial Cable for Hardware Handshaking

    The HP 7475A wakes up with hardware handshaking enabled: DTR starts high and goes low when the internal 1 KB buffer has less than 80 bytes remaining. The plotter also supports XON/XOFF handshaking, a sad software thing you’d use only if you had no other choice.

    The Chiplotle doc provides a wiring diagram for a suitable 9-to-25 pin cable, so I printed one and doodled on it while pondering the Great Cable Stash:

    HP7475A Plotter - Serial Cable
    HP7475A Plotter – Serial Cable

    The color codes over on the left of the top diagram match a prebuilt cable I hoped to repurpose, but it had only five conductors, none of which were DSR or CTS. Pfui!

    So I used a hank of gorgeous flexy 9-conductor cable (which came with premolded DE-9 ends of the wrong gender, now amputated into pigtails and back in the GCS), which supported the connections redrawn on the bottom in proper numeric order, used the obvious color sequence (Bn R O Y G Bl V W K), then soldered suitable connectors on each end:

    HP 7475A Plotter - serial cable
    HP 7475A Plotter – serial cable

    And it worked the first time…

  • RPi: Time-lapse Photos

    The Raspberry Pi doc provides a recipe for the simplest possible time-lapse webcam: fire fswebcam once a minute from a cron job.

    The crontab entry looks much like their example:

    * * * * * /home/ed/bin/grabimg.sh 2>&1
    

    I put all the camera details in the ~/.config/fswebcam.conf config file:

    # Logitech C130 / C510 camera
    device v4l2:/dev/video0
    input 0
    resolution 1280x720
    set sharpness=128
    jpeg 95
    set "power line frequency"="60 hz"
    #no-banner
    

    That simplifies the ~/bin/grabimg.sh script:

    #!/bin/bash
    DATE=$(date +"%Y-%m-%d_%H.%M.%S")
    fswebcam -c /home/ed/.config/fswebcam.conf /mnt/samba/webcam/$DATE.jpg
    

    The output directory lives on a Samba-shared USB stick jammed in the back of the Asus router, so I need not putz with a Samba server on the RPi.

    Manually mounting the share, which for the moment is the /testfolder/webcam directory on the USB stick:

    sudo mount -t cifs -o user=ed //gateway/testfolder/webcam /mnt/samba
    

    I’m pretty sure automagically mounting the share will require the same workarounds as on my desktop box, but this fstab entry is a start:

    #-- ASUS router Samba share
    //gateway/testfolder/webcam	/mnt/samba	cifs	auto,uid=ed,credentials=/root/.gateway-id 0 0
    

    That requires a corresponding credentials file with all the secret info:

    domain=WHATSMYNET
    username=ed
    password=pick-your-own
    

    This is mostly a test to see how long it takes before something on the RPi goes toes-up enough to require a manual reboot. Disabling the WiFi link’s power saving mode seems to keep the RPi on the air all the time, which is a start.