Ticket #3077: mediamonitor-scd-fix.diff

File mediamonitor-scd-fix.diff, 1.2 KB (added by devel@…, 8 years ago)

Fix model lookup for cd devices with scd0/sr0 device names

  • mythtv/libs/libmyth/mediamonitor-unix.cpp

     
    238238    if (devpath.isSymLink())
    239239        devname = devpath.readLink();
    240240
     241        // Given something like /dev/hda1, extract hda1
     242        devname = devname.mid(5,5);     
    241243
    242     // Given something like /dev/sdb1, extract sdb
    243     devname = devname.mid(5,3);
    244 
    245 
    246244#ifdef linux
    247245    if (devname.startsWith("hd"))  // IDE drive
    248246    {
     247                devname = devname.left(3); // Given hda1, extract hda
     248
    249249        QFile  file("/proc/ide/" + devname + "/model");
    250250        if (file.open(IO_ReadOnly))
    251251        {
     
    256256        }
    257257    }
    258258
    259     if (devname.startsWith("sd"))  // SATA/USB/FireWire
     259        else if ((devname.startsWith("sd"))||(devname.startsWith("sr"))||(devname.startsWith("scd")))  // SATA/USB/FireWire
    260260    {
    261         QString path = devname.prepend("/sys/block/");
     261
     262                if (devname.startsWith("scd")) // scd0 doesn't appear in /sys/block, use sr0 instead
     263                        devname="sr" + devname.mid(3);
     264
     265                QString path = devname.prepend("/sys/block/");
    262266        path.append("/device/");
    263267
    264268        QFile  file(path + "vendor");