FireWire (1394) bandwidth sharing with FireGrab (error 28)

Two or more cameras can share a bus, but you must manage packetsize. Divide the packetsize by the number of cameras per bus to avoid
HALER_NOBUSRESOURCES returned on OpenCapture().

FGP_CARD tracks the number of buses per controller. In this sense “Card” means “bus”, NOT physical card count (some cards have multiple bus controllers).

CFGCamera Camera[NMAXCNT];
UINT32 NodeCntPerCard[NMAXCNT],Card[NMAXCNT];

```// Step through node list
for(i=0;i<NodeCnt;i++)
{
  // Connect device to object
  Camera[i].Connect(&NodeInfo[i].Guid, &Camera[i]);
  // Get number of cameras per card
  Camera[i].GetParameter(FGP_CARD, Card[i]);
  NodeCntPerCard[Card[i]]++;
}

...
// Set format, divide payload
UINT32   Speed(0),PktSize(0);
for(i=0;i<NodeCnt;i++)
{
 // Set Format 7, Mode 0, Y8
  Result=Camera[i].SetParameter(FGP_IMAGEFORMAT,MAKEIMAGEFORMAT(RES_SCALABLE,CM_Y8,0));
  // Get phy speed
  if(Result==FCE_NOERROR)
     Result=Camera[i].GetParameter(FGP_PHYSPEED, &Speed);
  // Divide PacketSize by number of cameras
  if(Result==FCE_NOERROR)
     PktSize=(1024<<Speed)/NodeCntPerCard[Card[i]]);
  // Set PacketSize
  if(Result==FCE_NOERROR)
    Result=Camera[i].SetParameter(FGP_PACKETSIZE, PktSize);
  if(Result==FCE_ADJUSTED)
     Result=Camera[i].GetParameter(FGP_PACKETSIZE, &PktSize);
  // Start DMA logic
  if(Result==FCE_NOERROR)
     Result=Camera[i].OpenCapture();
}