Whither Intel?

It’s been a few weeks since I had a few interactions with the Intel Corporation, so I thought I’d write up a summary of what I think they’re screwing up from the small-developer / indie-developer perspective, in case whoever they choose as their next CEO is open to actual, on-the-ground perspectives.

The start of the story goes something like this: I had an idea about building a piece of electronics using their Thunderbolt 3 connectivity chips. It wasn’t such a huge idea, let’s say, but it would’ve been interesting to me, and it provided an excuse to learn more about the technology.

Continue reading Whither Intel?

Thoughts on the GDPR

Heard some people, while I was eating a burrito this evening, talking about the effects of the General Data Protection Regulation (GDPR) coming into force in the European Union next month.

We’ve been discussing this at work lately, as I suspect most businesses are currently, as the GDPR will have huge effects on every modern business in the EU. The service economy is going to have a nice time adjusting to the new rules. It’s going to have a huge impact, and much of what I’m hearing is that it is pretty unclear which direction the implementation of this rule is going to go.

But since I have my doubts about potentially reasonable ideas being used in a well-intentioned manner, here are a few things I think will happen:

1. A bunch of shitty lawyers are going to make a shitload of money off of frivolous lawsuits enabled by the high asymmetric penalties of the GDPR. I’m sure plenty of privacy-justice warriors are going to emerge and abuse the rules.
2. People are going to troll the shit out of this system.
3. A lot of personal data will end up being even easier to tie together using a single primary key / selector (email address, first name + last name, phone number, etc.) because companies will want better mechanisms for eliminating all of that data. Of course, this will just make it easier to gather adversarial intelligence, if a company’s data is compromised.
4. The big cloud players will get bigger, providing turnkey solutions to erase all data related to an individual. Scale will win the day.
5. The small players and Mom and Pop shops will struggle to comply with the GDPR, as usual, and eventually turn over more data to the big cloud players and SaaS offerings.
6. Companies might actually start adding automatic expiration to idle accounts, which would solve a huge number of issues in data privacy anyways. If companies like Yahoo or Facebook actually did this, and stopped trying to juke the stats on userbase growth, a lot less data would have been lost. Simply letting accounts decay, as in the natural order of things, would eliminate huge swaths of leftover identity theft and sources of email spam.

But as far as the GDPR goes, I don’t think we’re going to get any closer to having this for our in-cloud data:

Would be nice if we could do this to all of the data about us online, huh?

Anyways, maybe next time.

A Visit to Huaqiangbei Market by an Embedded Systems Engineer

After reading about the world’s largest electronics market in Shenzhen several years ago, I finally had a chance to visit it in early 2018 during an engineering trip to the region. I had two afternoons and a weekend to explore its offerings, and I am sure I missed plenty.

h/t to Goodians for the map

Huaqiangbei (“Huaqiang North” or “HQB”) is a 16+ city block area plus outlier buildings which house representatives of numerous Chinese semiconductor and electronics manufacturing companies located in Shenzhen.

Continue reading A Visit to Huaqiangbei Market by an Embedded Systems Engineer

Wiping Out An SSD

I had a really old solid-state disk in need of wiping. It’s one of Samsung’s very first OEM models and I’m not even sure what machines they were originally installed into with their super-uncommon uSATA connector.

Photo of Samsung uSATA SSD

There’s no way to completely wipe out an SSD without resorting to specialized software from the manufacturer (Samsung Magician, for instance, if it supports the drive), or grinding it up in a shredder or smashing it to pieces.

But you can get somewhat close by writing all 1’s to the flash cells, which also resets them to their default electrically-erased state and can improve later writes.

Here’s how to do that (based on this and this):

$ tr '\0' '\377' < /dev/zero | sudo dd bs=1M of=/dev/sda status=progress
128024002560 bytes (128 GB, 119 GiB) copied, 1699 s, 75.4 MB/s   
dd: error writing '/dev/sda': No space left on device
962+13746532 records in
962+13746531 records out
128035676160 bytes (128 GB, 119 GiB) copied, 1701.93 s, 75.2 MB/s

$ tr '\0' '\377' < /dev/zero | sudo dd bs=1M of=/dev/sda status=progress
128019283968 bytes (128 GB, 119 GiB) copied, 1488.01 s, 86.0 MB/s
dd: error writing '/dev/sda': No space left on device
995+13790140 records in
995+13790139 records out
128035676160 bytes (128 GB, 119 GiB) copied, 1490.82 s, 85.9 MB/s

$ tr '\0' '\377' < /dev/zero | sudo dd bs=1M of=/dev/sda status=progress
128033210368 bytes (128 GB, 119 GiB) copied, 1487.01 s, 86.1 MB/s
dd: error writing '/dev/sda': No space left on device
833+13799595 records in
833+13799594 records out
128035676160 bytes (128 GB, 119 GiB) copied, 1489.74 s, 85.9 MB/s

The first erasure is slower than the second, even though I'm not sure this drive has TRIM support. CrystalDiskInfo says it doesn't. Samsung's Magician software says it does. The second and third erasures exhibit identical write speeds.

CrystalDiskInfo for Samsung uSATA SSD

Samsung Magician for Samsung uSATA SSD

It's a weird drive anyways, but might still be useful as a relatively-quick portable hard disk, depending on the workload.

It is only useful for sequential writes. Its 4K and random write scores are pretty atrocious.

Before the wipe (drive filled with OS, data, etc.):

Samsung 120GB uSATA SSD (before full erase)

After the wipe (drive cleared with all 1s):

Under Ubuntu, the SATA drive information looks as follows:

$ sudo hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
	Model Number:       SAMSUNG SSD Thin uSATA 128GB M
	Serial Number:      DFFC30S912SE912A6439
	Firmware Revision:  VAM05D1Q
Standards:
	Used: ATA/ATAPI-7 T13 1532D revision 1
	Supported: 7 6 5 4
Configuration:
	Logical		max	current
	cylinders	16383	16383
	heads		16	16
	sectors/track	63	63
	--
	CHS current addressable sectors:    16514064
	LBA    user addressable sectors:   250069680
	LBA48  user addressable sectors:   250069680
	Logical/Physical Sector size:           512 bytes
	device size with M = 1024*1024:      122104 MBytes
	device size with M = 1000*1000:      128035 MBytes (128 GB)
	cache/buffer size  = unknown
	Nominal Media Rotation Rate: Solid State Device
Capabilities:
	LBA, IORDY(can be disabled)
	Standby timer values: spec'd by Standard, no device specific minimum
	R/W multiple sector transfer: Max = 16	Current = 16
	Recommended acoustic management value: 128, current value: 0
	DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5 
	     Cycle time: min=120ns recommended=120ns
	PIO: pio0 pio1 pio2 pio3 pio4 
	     Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
	Enabled	Supported:
	   *	SMART feature set
	    	Security Mode feature set
	   *	Power Management feature set
	   *	Write cache
	   *	Look-ahead
	   *	Host Protected Area feature set
	   *	WRITE_BUFFER command
	   *	READ_BUFFER command
	   *	NOP cmd
	   *	DOWNLOAD_MICROCODE
	    	SET_MAX security extension
	    	Automatic Acoustic Management feature set
	   *	48-bit Address feature set
	   *	Device Configuration Overlay feature set
	   *	Mandatory FLUSH_CACHE
	   *	FLUSH_CACHE_EXT
	   *	SMART error logging
	   *	SMART self-test
	   *	General Purpose Logging feature set
	   *	WRITE_{DMA|MULTIPLE}_FUA_EXT
	   *	64-bit World wide name
	   *	WRITE_UNCORRECTABLE_EXT command
	   *	Segmented DOWNLOAD_MICROCODE
	   *	Gen1 signaling speed (1.5Gb/s)
	   *ssssss	Gen2 signaling speed (3.0Gb/s)
	   *	Host-initiated interface power management
	   *	Phy event counters
	    	Device-initiated interface power management
	   *	Software settings preservation
Security: 
	Master password revision code = 65534
		supported
	not	enabled
	not	locked
	not	frozen
	not	expired: security count
		supported: enhanced erase
	6min for SECURITY ERASE UNIT. 6min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 50000f0056414431
	NAA		: 5
	IEEE OUI	: 0000f0
	Unique ID	: 056414431
Checksum: correct

Also under Ubuntu, the SMART information for the drive looks as follows, note the relatively large number of Power On Hours, this drive had a very heavy service life:

$ sudo smartctl -a /dev/sda
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.13.0-21-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     SAMSUNG SSD Thin uSATA 128GB M
Serial Number:    DFFC30S912SE912A6439
LU WWN Device Id: 5 0000f0 056414431
Firmware Version: VAM05D1Q
User Capacity:    128,035,676,160 bytes [128 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA/ATAPI-7 T13/1532D revision 1
Local Time is:    Wed Dec 27 13:51:49 2017 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x02)	Offline data collection activity
					was completed without error.
					Auto Offline Data Collection: Disabled.
Self-test execution status:      (  40)	The self-test routine was interrupted
					by the host with a hard or soft reset.
Total time to complete Offline 
data collection: 		(  360) seconds.
Offline data collection
capabilities: 			 (0x53) SMART execute Offline immediate.
					Auto Offline data collection on/off support.
					Suspend Offline collection upon new
					command.
					No Offline surface scan supported.
					Self-test supported.
					No Conveyance Self-test supported.
					Selective Self-test supported.
SMART capabilities:            (0x0003)	Saves SMART data before entering
					power-saving mode.
					Supports SMART auto save timer.
Error logging capability:        (0x01)	Error logging supported.
					General Purpose Logging supported.
Short self-test routine 
recommended polling time: 	 (   6) minutes.
Extended self-test routine
recommended polling time: 	 (  36) minutes.

SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  9 Power_On_Hours          0x0032   096   096   000    Old_age   Always       -       18948
 12 Power_Cycle_Count       0x0032   098   098   000    Old_age   Always       -       1962
175 Program_Fail_Count_Chip 0x0032   100   100   011    Old_age   Always       -       0
176 Erase_Fail_Count_Chip   0x0032   100   100   011    Old_age   Always       -       0
177 Wear_Leveling_Count     0x0013   100   100   023    Pre-fail  Always       -       0
178 Used_Rsvd_Blk_Cnt_Chip  0x0013   095   095   011    Pre-fail  Always       -       5
179 Used_Rsvd_Blk_Cnt_Tot   0x0013   099   099   010    Pre-fail  Always       -       26
180 Unused_Rsvd_Blk_Cnt_Tot 0x0013   099   099   010    Pre-fail  Always       -       3878
181 Program_Fail_Cnt_Total  0x0032   099   099   010    Old_age   Always       -       1
182 Erase_Fail_Count_Total  0x0032   100   100   010    Old_age   Always       -       0
183 Runtime_Bad_Block       0x0013   099   099   010    Pre-fail  Always       -       1
187 Reported_Uncorrect      0x0033   100   100   000    Pre-fail  Always       -       0
195 Hardware_ECC_Recovered  0x001a   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   253   253   000    Old_age   Always       -       255
232 Available_Reservd_Space 0x0013   095   095   011    Pre-fail  Always       -       117
233 Media_Wearout_Indicator 0x0032   071   071   000    Old_age   Always       -       1232987101

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Interrupted (host reset)      80%     18456         -
# 2  Short offline       Interrupted (host reset)      90%     18456         -
# 3  Short offline       Completed without error       00%     12752         -
# 4  Short offline       Completed without error       00%         5         -
# 5  Short offline       Completed without error       00%         3         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

This drive is a piece of junk, it is "just enough" SSD, which is why it came "free" as part of the selling points for a used laptop I bought off of eBay, and which is why I replaced it shortly thereafter with a proper Samsung EVO-series drive.