[mythtv-commits] Ticket #5278: Firewire Uses Bad Port Number and Fails

MythTV mythtv at cvs.mythtv.org
Wed Nov 18 14:08:25 UTC 2009


#5278: Firewire Uses Bad Port Number and Fails
---------------------------------+------------------------------------------
 Reporter:  scottadmi@…          |       Owner:  ijr     
     Type:  defect               |      Status:  assigned
 Priority:  minor                |   Milestone:  unknown 
Component:  MythTV - Recording   |     Version:  0.21    
 Severity:  medium               |     Mlocked:  0       
---------------------------------+------------------------------------------

Comment(by anonymous):

 I've implemented exactly the patch described above and tried antagonizing
 it in a way which would cause it to fail previously... It hasn't failed
 yet and my logs indicate it also hasn't failed for my wife in the last 2
 days...There's a problem with the above, however.   Since 'tmp' isn't
 technically initialized, we could go in to get_guid and come back out with
 'tmp' != 0 and consequently loop indefinitely. We don't really need any of
 that old code, however, so can get rid of get_guid entirely.  There's one
 problem with my diff however; and that is cooked1394_read() will time out
 after 20*20ms read attempts. After 2 of those, we could return from
 rom1394_get_guid() with a bogus guid... We should probably still use the
 guid_timer to detect this condition and do something smart; but I'm not
 sure what 'something smart' is in this case...

 Here's what I've got... This does appear to work and I've not been able to
 antagonize it into failing ...

 {{{

 Index: linuxfirewiredevice.cpp
 ===================================================================
 --- linuxfirewiredevice.cpp     (revision 20752)
 +++ linuxfirewiredevice.cpp     (working copy)
 @@ -120,8 +120,6 @@
  static QString speed_to_string(uint speed);
  static int linux_firewire_device_bus_reset_handler(
      raw1394handle_t handle, uint generation);
 -static bool get_guid(raw1394handle_t handle, nodeid_t node,
 -                     uint64_t &guid, bool &temp_unavailable);

  LinuxFirewireDevice::LinuxFirewireDevice(
      uint64_t guid, uint subunitid,
 @@ -881,27 +879,15 @@
              continue;
          }

 -        MythTimer guid_timer;
 -        guid_timer.start();
          for (int node = 0; node < raw1394_get_nodecount(item.handle);
 node++)
          {
 -            bool tmp;
              uint64_t guid;
 -            if (!get_guid(item.handle, 0xffc0 | node, guid, tmp))
 -            {
 -                if (tmp && (guid_timer.elapsed() < 200))
 -                { // device has gone off-line temporarily
 -                    usleep(10 * 1000);
 -                    node--;
 -                }
 -                continue; // device has gone off-line
 -            }

 +            guid = rom1394_get_guid(item.handle, node);
              item.port = port;
              item.node = node;
              UpdateDeviceListItem(guid, &item);
              guid_online[guid] = true;
 -            guid_timer.start();
          }

          raw1394_destroy_handle(item.handle);
 @@ -1030,36 +1016,3 @@

      return 0;
  }
 -
 -// get_guid copied from plugreport, Copyright 2002-2004 Dan Dennedy GPL
 v2+
 -#define PLUGREPORT_GUID_HI 0x0C
 -#define PLUGREPORT_GUID_LO 0x10
 -static bool get_guid(raw1394handle_t handle, nodeid_t node, uint64_t
 &guid,
 -                     bool &temp_unavailable)
 -{
 -    uint64_t offset = CSR_REGISTER_BASE + CSR_CONFIG_ROM +
 PLUGREPORT_GUID_HI;
 -    uint32_t quadlet;
 -    int err = raw1394_read(handle, node, offset, sizeof(uint32_t),
 &quadlet);
 -    if (-1 == err)
 -    {
 -        temp_unavailable = (errno == 11);
 -        if (!temp_unavailable)
 -            VERBOSE(VB_IMPORTANT, "get_guid 1, Error: " + ENO);
 -        return false;
 -    }
 -    guid = htonl(quadlet);
 -    guid <<= 32;
 -
 -    offset = CSR_REGISTER_BASE + CSR_CONFIG_ROM + PLUGREPORT_GUID_LO;
 -    err = raw1394_read(handle, node, offset, sizeof(uint32_t), &quadlet);
 -    if (-1 == err)
 -    {
 -        temp_unavailable = (errno == 11);
 -        if (!temp_unavailable)
 -            VERBOSE(VB_IMPORTANT, "get_guid 2, Error: " + ENO);
 -        return false;
 -    }
 -    guid += htonl(quadlet);
 -
 -    return true;
 -}

 }}}

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/5278#comment:31>
MythTV <http://www.mythtv.org/>
MythTV


More information about the mythtv-commits mailing list