SVN commit 494661 by adridg:

For FreeBSD, cdparanoia's autosearch combined with either ATAPICAM (ATAPI-SCSI) 
or plain ATAPI doesn't fill in the expected fields in the CAM structure; that 
causes crashes. So go case-by case and use what makes sense. For the ATAPI 
case, assume the user has specified a device name because otherwise we need to 
map an open fd back to a pathname (knowing it's in /dev/ helps, and it's just a 
bunch of fstat and stat calls, but still).

CCMAIL: [EMAIL PROTECTED]

PS. Markus Brueffer has patches to cdparanoia to add the Linux-style field 
cdda_device_name so that we can drop this whole chunk of ifdefs and just use 
that field. This moves the smarts into cdparanoia itself. We will add a 
configure check when that comes around.


 M  +34 -1     audiocd.cpp  


--- branches/KDE/3.5/kdemultimedia/kioslave/audiocd/audiocd.cpp #494660:494661
@@ -218,7 +218,40 @@
 #if defined(Q_OS_LINUX)
        d->cd.setDevice(drive->cdda_device_name, 50, false);
 #elif defined(Q_OS_FREEBSD)
-       d->cd.setDevice(drive->dev->device_path);
+       // FreeBSD's cdparanoia as of january 5th 2006 has rather broken
+       // support for non-SCSI devices. Although it finds ATA cdroms just
+       // fine, there is no straightforward way to discover the device
+       // name associated with the device, which throws the rest of audiocd
+       // for a loop.
+       //
+       if ( !(drive->dev) || (COOKED_IOCTL == drive->interface) )
+       {
+               // For ATAPI devices, we have no real choice. Use the
+               // user selected value, even if there is none.
+               //
+               kdWarning(7117) << "Found an ATAPI device, assuming it is the 
one specified by the user." << endl;
+               d->cd.setDevice( d->device );
+       }
+       else
+       {
+               kdDebug(7117) << "Found a SCSI or ATAPICAM device." << endl;
+               if ( strlen(drive->dev->device_path) > 0 )
+               {
+                       d->cd.setDevice( drive->dev->device_path );
+               }
+               else
+               {
+                       // But the device_path can be empty under some
+                       // circumstances, so build a representation from
+                       // the unit number and SCSI device name.
+                       //
+                       QString devname = QString::fromLatin1( "/dev/%1%2" )
+                               .arg( drive->dev->given_dev_name )
+                               .arg( drive->dev->given_unit_number ) ;
+                       kdDebug(7117) << "  Using derived name " << devname << 
endl;
+                       d->cd.setDevice( devname );
+               }
+       }
 #endif
 
        if (d->cd.discId() != d->discid && d->cd.discId() != d->cd.missingDisc){
_______________________________________________
kde-freebsd mailing list
[email protected]
http://freebsd.kde.org/mailman/listinfo/kde-freebsd

Reply via email to