Skip to content
Permalink
Browse files

Try to fix Firewire recording on Intel Macs. Refs #8371.

Untested by me except for compilation. There might be other data fields that
need endian swapping, but hopefully this won't break working PPC setups.
  • Loading branch information
NigelPearson committed Oct 11, 2011
1 parent c0ae87c commit ef64fad06f941a9f01fe0cf48fcf8eb350dc17ff
Showing with 7 additions and 0 deletions.
  1. +7 −0 mythtv/libs/libmythtv/darwinfirewiredevice.cpp
@@ -17,6 +17,7 @@
#include <IOKit/firewire/IOFireWireLibIsoch.h>
#include <IOKit/firewire/IOFireWireFamilyCommon.h>
#include <IOKit/avc/IOFireWireAVCLib.h>
#include <CoreServices/CoreServices.h> // for EndianU32_BtoN() etc.

// Std C++ headers
#include <algorithm>
@@ -375,6 +376,7 @@ int DarwinFirewireDevice::GetMaxSpeed(void)
uint32_t val;
int ret = (*fw_handle)->ReadQuadlet(
fw_handle, dev, &addr, (UInt32*) &val, false, 0);
val = EndianU32_BtoN(val);

return (ret == kIOReturnSuccess) ? (int)((val>>30) & 0x3) : -1;
}
@@ -400,6 +402,7 @@ bool DarwinFirewireDevice::IsSTBStreaming(uint *fw_channel)
uint32_t val;
int ret = (*fw_handle)->ReadQuadlet(
fw_handle, dev, &addr, (UInt32*) &val, false, 0);
val = EndianU32_BtoN(val);

if (ret != kIOReturnSuccess)
return false;
@@ -714,6 +717,7 @@ bool DarwinFirewireDevice::UpdatePlugRegisterPrivate(
{
return false;
}
old_plug_val = EndianU32_BtoN(old_plug_val);

int old_plug_cnt = (old_plug_val >> 24) & 0x3f;
int old_fw_chan = (old_plug_val >> 16) & 0x3f;
@@ -758,6 +762,9 @@ bool DarwinFirewireDevice::UpdatePlugRegisterPrivate(
new_plug_val &= ~(0x03<<14);
new_plug_val |= (new_speed & 0x03) << 14;

old_plug_val = EndianU32_NtoB(old_plug_val);
new_plug_val = EndianU32_NtoB(new_plug_val);

return (kIOReturnSuccess == (*fw_handle)->CompareSwap(
fw_handle, dev, &addr, old_plug_val, new_plug_val, false, 0));
}

0 comments on commit ef64fad

Please sign in to comment.
You can’t perform that action at this time.