[mythtv] libmyth windows CD handler (so far only a proof of concept)

Jonathan Martens jonathan at snetram.nl
Fri Aug 7 20:08:18 UTC 2009


On 7-8-2009 19:15, Jonathan Martens wrote:
> Until now I have hardcoded my drivePath to the CD drive I am using.
> Since I do not know any way of retrieving the drivePath for a device
> from a subclass of MythCDROM (which in turn is a child of
> MythMediaDevice) I turn to you. It seems the getDrivePath() method is in
> the MythMediaDevice class but I have no clue how to gat access to that
> from MythCDROMWindows. Can some of the dev's or more experienced MythTV
> developers help me with this?

After a good meal and some rest I found out that m_RealDevice and 
m_DevicePath are accessible in the MythCDROMWindows class (as in all the 
other classes), so I can now create my handle to the optical drive like 
this:

const char *devicePath = strncat("\\\\.\\", m_RealDevice.toLocal8Bit(),2);

HANDLE hDevice;

return hDevice = CreateFile(
     devicePath,
     GENERIC_READ,
     FILE_SHARE_READ | FILE_SHARE_WRITE,
     NULL,
     OPEN_EXISTING,
     0,
     NULL
);

Now off to drink a beer!

Cheers,

Jonathan


More information about the mythtv-dev mailing list