KBNLresearch / iromlab

Loader software for automated imaging of optical media with Nimbie disc robot
Apache License 2.0
33 stars 5 forks source link

Check if cdDriveLetter is a valid drive #14

Closed bitsgalore closed 7 years ago

bitsgalore commented 7 years ago

Could be done by calling cd-info with the -l option, which produces output like this:

C:\cdio\cd-info version 0.93 x86_64-w64-mingw32
Copyright (c) 2003-2005, 2007-2008, 2011-2013 R. Bernstein
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
CD location   : \\.\D:
CD driver name: WIN32
   access mode: ioctl

Vendor                      : ATAPI   
Model                       : DVD A  DH16A6L  
Revision                    : ZH37
Hardware                                  : CD-ROM or DVD
Can eject                                 : Yes
Can close tray                            : Yes
Can disable manual eject                  : Yes
Can select juke-box disc                  : No

Can set drive speed                       : No
Can read multiple sessions (e.g. PhotoCD) : Yes
Can hard reset device                     : Yes

Reading....
  Can read Mode 2 Form 1                  : Yes
  Can read Mode 2 Form 2                  : Yes
  Can read (S)VCD (i.e. Mode 2 Form 1/2)  : Yes
  Can read C2 Errors                      : Yes
  Can read IRSC                           : Yes
  Can read Media Channel Number (or UPC)  : Yes
  Can play audio                          : Yes
  Can read CD-DA                          : Yes
  Can read CD-R                           : Yes
  Can read CD-RW                          : Yes
  Can read DVD-ROM                        : Yes

Writing....
  Can write CD-RW                         : Yes
  Can write DVD-R                         : Yes
  Can write DVD-RAM                       : Yes
  Can write DVD-RW                        : No
  Can write DVD+RW                        : No
list of devices found:
Drive \\.\D:
Vendor  : ATAPI   
Model   : DVD A  DH16A6L  
Revision: ZH37
Drive \\.\I:
Vendor  : ATAPI   
Model   : DVD A  DH16A6L  
Revision: ZH37
__________________________________

Disc mode is listed as: DVD-ROM
No further information currently given for DVDs.
Use --dvd to override.

So this would need another wrapper function that checks all lines that define a Drive:

Drive \\.\D:

and

Drive \\.\I:

Alternatively we could try to open the device in raw mode (e.g. using this), but that doesn't tell us if the drive is an optical drive. So the cd-info approach looks better.

bitsgalore commented 7 years ago

Added this check in https://github.com/KBNLresearch/iromlab/commit/6594847af13812628bf63087ae78886bf888b343