User:Gordon/Optical Drive Testing Script

From FreekiWiki
Jump to navigation Jump to search

status :: time log :: code
dev scratchpad

Why automate optical drive testing?

Optical drive testing is currently a time consuming, error prone manual process that relies too much on human judgement and doesn't yield enough information about the drives being tested. A look at the current testing documents reveal a very complicated flowchart and several long lists of instructions for testing various types of drives. Based on the documentation and in my experience in Advanced Testing, much more human effort is expended per drive than many of the drives are worth; a brand-new DVD+R dual layer burner can be had for $27 on Newegg. This is a process that begs for increased automation so that less work time is spent per drive and fewer testing errors occur. Faster testing will also help clear valuable floor space in Advanced Testing. Better labeling will help in Build and in the Thrift Store.

I propose the following:

  • To write software which makes use of freely-available open source tools in order to standardize and largely automate the identification and testing of optical drives
  • To provide standardized test subjects for the software (i.e. CDs and DVDs pre-burned with known test data)
  • To create a specification for sticky labels, if such labels are deemed useful by Free Geek staff, such that drives are better identified according to their capabilities
  • To make the software configurable such that Free Geek staff can easily change the criteria by which the software instructs volunteers to recycle drives as the capabilities of incoming hardware continue to improve

Proposed testing strategy

Right now, on the subject of optical drive hardware, much of this is written from my memory and general knowledge. Please correct it if it is wrong.

Testing needs

Assuming we are testing a multifunction drive that can read and write both CDs and DVDs, there are several main functions which we need to test:

  1. The mechanical function of the drive, including its ability to spin properly and the ability of the laser sled to move back and forth properly over its full required range of motion.
  2. The function of the CD read laser and pickup.
  3. The function of the CD write laser. It is my understanding that CD-R and CD-RW discs are written with the same laser, and higher power is used to write CD-RW discs. This is the basis for my assertion that a write test on CD-RW is sufficient to also declare CD-R write capability good.
  4. The function of the DVD read laser and pickup.
  5. The function of the DVD write laser. Again, it is my understanding that writing a DVD+RW uses the same laser as writing a DVD-R and DVD+R but at higher power. This is the basis for my assertion that a write test on DVD+RW is sufficient to also declare DVD-R and DVD+R write capability good.

Meeting testing needs

  1. The drive's mechanical function can be tested with a CD-ROM read test which reads and verifies data from both the central and peripheral surfaces of a disc. If the drive cannot spin properly, the test will fail. If the laser sled is sticky, it may fail to read the outside or inside edge of a disc. I propose to use pre-burned CD-ROMs with multiple sessions containing files full of random data for which a hash is known. The basic read test would read the innermost and outermost session on the disc, verify the data it gets back using the hash, and time the test so as to reject drives which are returning valid data only after many retries.
  2. The above test also implicitly tests the CD read laser/pickup.
  3. To test the CD write laser, a data file would be written to a CD-RW and then read back and verified. This would be done in sessions. "Lead-in and lead-out of the first session occupy 28 MB that is reduced to 13 MB for all following sessions. Twenty sessions therefore have 275 MB of overhead, and only 378 MB is available for user information."[1] Therefore, a maximum of about 18.9MB of data should be burned per session on a 20-session disc.
  4. To test the DVD read laser/pickup, a similar test as done for the CD function would be done with a pre-burned DVD-ROM.
  5. To test the DVD write laser, a similar (but larger) data file as for the CD-RW test would be written to a DVD+RW and then read back and verified. DVD+R session overhead is about 4MB per session.[2] Minus 80MB for session overhead, there is about 4402MB of usable capacity on the disc, meaning a maximum of about 220MB of data should be burned per session on a 20-session disc. As it turns out, writing multisession DVD-RW discs is highly problematic at best,[3] and DVD+RW is far more likely to work for multisession burning in a wide variety of drives. Thus I am reversing my earlier position on using DVD-RW media, as it would have to be quick-blanked for every test; this disadvantage plus its other disadvantages is enough to tip the scales in favor of DVD+RW in my opinion.

Eventually, rewritable media will either wear out or become scratched and dirty and need to be replaced. How to detect this and whether the user can be automatically instructed to discard old media is an open question. It can probably be solved either by obtaining a unique ID from the discs themselves and keeping a log in a database, or writing an ID to the discs as part of their initialization.

Software requirements

  • The script must correctly identify CD-ROM, CD-RW, DVD-ROM+CD-RW (combo), DVD +/- RW, and DVD+R dual layer (DL) drives. I will leave DVD-RAM out because DVD-RAM-only drives are uncommon and should probably be recycled.
  • The script must test read functionality from known-good CD-ROMs for CD capable drives.
  • The script must test read functionality from known-good DVD-ROMs for DVD capable drives.
  • The script must test read functionality on both the central and peripheral surfaces of a known-good disc in order to rule out laser sled malfunctions.
  • The script must test and verify write functionality on a known-good CD-RW disc for CD write capable drives. We assume that the ability to successfully write to CD-RW (high laser power) indicates the ability to successfully write to CD-R.
    • If using sessions, the script must erase CD-RWs when they fill up with test sessions to enable their reuse.
  • The script must test and verify DVD+RW write functionality on a known-good DVD+RW disc for DVD write capable drives. We assume that the ability to successfully write to DVD+RW (high laser power) indicates the ability to successfully write to DVD+R and DVD-R/RW; see the next subsection for more information on this assumption.
    • If using sessions, the script must erase DVD+RWs when they fill up with test sessions to enable their reuse.

Requirements which need vetting by Free Geek staff

  • I believe that DVD+R/RW drives which are not capable of DVD-R/RW are a very small minority. In my (dated) research, DVD-R/RW is more widely compatible with various equipment than DVD+R/RW, so I propose testing only with DVD-R/RW and assuming this indicates DVD+R/RW functionality (if present) will also work, since the same physical hardware is involved; I further propose recycling any old drives that are not capable of DVD-R/RW (i.e. DVD+R/RW-only drives).
  • Upon doing further research, I found out that a testing strategy based on burning multiple sessions to a disc is very likely to not work on DVD-RW media, and much more likely to work on DVD+RW media because of differences in the way information is stored on the media.[4] Therefore, I propose testing only with DVD+R/RW and assuming this indicates proper DVD-R/RW functionality. I also propose that any drives that do not support both formats be recycled.

"Nice to have" requirements

  • It'd be nice if the script could keep track of how many times a rewritable disc has been used and tell the user to discard it and use a new one after a certain number of rewrite cycles. The buildup of scratches and dirt on the disc surface and the limited write cycle life of rewritable disc media will necessitate periodic replacement of test discs.
  • Identification of Lightscribe capability would be nice.
  • Creating a .deb package with proper dependencies, so that it could be added to Free Geek repos etc, would be great!

Software dependencies

  • The script, if written by me, will be written in Python (whatever version is installed by default in Ubuntu 9.10)
  • The script will depend on cdrkit, including (but not limited to) 'wodim' and 'genisoimage'.
  • The presence of /dev/urandom is assumed.

For semi-current information, see the dev scratchpad for this project.

Software interface specification

I've chosen to name the command line program 'lazers'.

Usage:

lazers [command] [options] [device]

Initializing discs for testing

Initializes discs for use as test media.

lazers init cd-r /dev/sr0
lazers init dvd+r /dev/sr0
lazers init cd-rw /dev/sr0
lazers init dvd+rw /dev/sr0

Testing a drive

(Requires initialized media of every type that will be used to test the drive.)

lazers test /dev/sr0

Media longevity and recycling

  • CD-RW and DVD+RW has a maximum rewrite lifetime of about 1,000 writes, though in practice this is probably much lower, and the discs will become scratched and dirty before they are rewritten 1000 times.
  • With a strategy of writing 20 test sessions a disc before a quick blank, a disc could be blanked and re-used 10 times in order to test 200 optical drives. This would rewrite the entire surface of the disc 10 times. I suspect discarding discs after this point may be a good rule of thumb as discs will inevitably become physically damaged over time.
  • CD-RW and DVD+RW media consist of a writable layer containing (among other elements and compounds) antimony and tellurium, which are toxic. Discs should be appropriately recycled and not smashed or broken.
  • CD-R and DVD+R media consist of a metal reflective layer and a writable layer of organic dyes of various types. The dyes are more stable (particularly in premium discs such as Taiyo Yuden CD-Rs) than the writable layer in rewritable discs, so the longevity of prerecorded test CD-Rs and DVD+Rs will likely be determined by physical damage from abrasion, heat, UV and humidity.
  • I don't know about the toxicity of CD-R and DVD+R dyes. The discs should be properly recycled and not broken or smashed.
  • I recommend Taiyo Yuden CD-Rs based on their proven dye stability.