freebsd-ports/multimedia/freevo/files/patch-src-plugins-rom_drives.py
Edwin Groothuis 375304aa7c NEW PORT: multimedia/freevo, an open-source home theatre PC platform
This is a new port for Freevo, an open-source home theatre
	PC platform based on Linux and a number of open-source
	audio/video tools.  I considered submitting this as a
	follow-up to ports/59047 but decided against as it is an
	entirely new port.

PR:		ports/68215
Submitted by:	Lewis Thompson <purple@lewiz.net>
Nagged by:	dnns@#bsdports
2004-11-23 22:31:56 +00:00

23 lines
1.1 KiB
Python

--- src/plugins/rom_drives.py Tue Aug 17 21:51:52 2004
+++ src/plugins/rom_drives.py Tue Aug 17 21:50:55 2004
@@ -409,9 +409,19 @@
data = array.array('c', '\000'*4096)
(address, length) = data.buffer_info()
buf = pack('BBHP', CD_MSF_FORMAT, 0, length, address)
- s = ioctl(fd, CDIOREADTOCENTRYS, buf)
+ #s = ioctl(fd, CDIOREADTOCENTRYS, buf)
+
+ # Above s = ioctl(... doesn't seem to work.
+ # Instead let's try and read from the disc, if it
+ # succeeds then there must be a disc in the drive.
+ # Nasty but it seems to work...
+ fd2 = open(media.devicename, 'rb')
+ fd2.seek(32768)
+ fd2.read(1)
+ fd2.close()
s = CDS_DISC_OK
except:
+ fd2.close()
s = CDS_NO_DISC
else:
s = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT)