Motti,

It looks like Rodolphe is correct that this camera does not advertise IIDC compatibility.

You can try adding "360" to this statement in identify_unit:

 if ((info.unit_spec_ID != 0xA02D) &&
            (info.unit_spec_ID != 0xB09D))

and see if anything works. If not, this camera probably won't work with libdc1394 unfortunately.

-David



On Tue, Jan 7, 2014 at 11:45 AM, Motti Shneor <motti.shneor@gmail.com> wrote:
Hi. 

I Debugged the faulty enumeration down to where it fails - in the enumeration.c, in the identify_unit() method.
I copied the method here, with a block right where the function fails, with the reason of failure and content of the info structure at that point.
As I don't know the IIDC standard, I don't know if the problem is in the Camera or in the Code --- can you have a look?

static int
identify_unit (dc1394_t * d, platform_info_t * platform,
        platform_device_t * dev, uint64_t guid,
        uint32_t offset, uint32_t * quads, int num_quads, int unit_num,
        uint32_t vendor_id)
{
    if (offset >= num_quads)
        return -1;
    int num_entries = quads[offset] >> 16;
    if (offset + num_entries >= num_quads)
        return -1;

    camera_info_t info;
    memset (&info, 0, sizeof (camera_info_t));

    info.guid = guid;
    info.unit = unit_num;
    info.device = dev;
    info.vendor_id = vendor_id;
    info.unit_directory = offset;
    info.platform = platform;

    uint32_t * dquads = quads + offset + 1;
    int i;
    for (i = 0; i < num_entries; i++) {
        uint32_t q = dquads[i];
        if ((q >> 24) == 0x12)
            info.unit_spec_ID = q & 0xffffff;
        if ((q >> 24) == 0x13)
            info.unit_sw_version = q & 0xffffff;
        if ((q >> 24) == 0xD4)
            info.unit_dependent_directory = (q & 0xffffff) + offset + i + 1;
        if ((q >> 24) == 0x17)
            info.model_id = q & 0xffffff;
    }

  /*
     Note on Point Grey (PG) cameras:
     Although not always advertised, PG cameras are 'sometimes' compatible
     with IIDC specs. This is especially the case with PG stereo products.
     The following modifications have been tested with a stereo head
     (BumbleBee). Most other cameras should be compatible, please consider
     contributing to the lib if your PG camera is not recognized.

     PG cams sometimes have a Unit_Spec_ID of 0xB09D, instead of the
     0xA02D of classic IIDC cameras. Also, their software revision differs.
     I could only get a 1.14 version from my BumbleBee but other versions
     might exist.

     As PG is regularly providing firmware updates you might also install
     the latest one in your camera for an increased compatibility.

     Damien

     (updated 2005-04-30)
  */

======================================================================
The following conditional fails, returning -1, because the info.unit_spec_ID is 360 (weirdly, it is the same as the vendor_id). Maybe previous code didn't do what it ought to do? 
Following is the contents of the info structure when the program reaches this conditional in the debugger.

(lldb) p info
(camera_info_t) $0 = {
  (uint64_t) guid = 396318107763586
  (int) unit = 0
  (uint32_t) unit_directory = 13
  (uint32_t) unit_dependent_directory = 17
  (uint32_t) unit_spec_ID = 360
  (uint32_t) unit_sw_version = 259
  (char *) vendor = 0x0000000000000000
  (char *) model = 0x0000000000000000
  (uint32_t) vendor_id = 360
  (uint32_t) model_id = 0
  (platform_device_t *) device = 0x00000001005002a0
  (platform_info_t *) platform = 0x0000000100118070
}
(lldb)
======================================================================
     if ((info.unit_spec_ID != 0xA02D) &&
            (info.unit_spec_ID != 0xB09D))
        return -1;
    if (!info.unit_dependent_directory)
        return -1;

    if (info.unit_dependent_directory >= num_quads)
        goto done;
    num_entries = quads[info.unit_dependent_directory] >> 16;
    if (info.unit_dependent_directory + num_entries >= num_quads)
        goto done;

    dquads = quads + info.unit_dependent_directory + 1;
    for (i = 0; i < num_entries; i++) {
        uint32_t q = dquads[i];
        if ((q >> 24) == 0x81)
            info.vendor = parse_leaf ((q & 0xffffff) +
                    info.unit_dependent_directory + 1 + i,
                    quads, num_quads);
        if ((q >> 24) == 0x82)
            info.model = parse_leaf ((q & 0xffffff) +
                    info.unit_dependent_directory + 1 + i,
                    quads, num_quads);
    }
done:
    info.unit_directory = info.unit_directory * 4 + 0x400;
    info.unit_dependent_directory = info.unit_dependent_directory * 4 + 0x400;
    return add_camera (d, &info);
}


On 7 בינו 2014, at 20:24, Rodolphe Pineau wrote:


On Tue 1/7/14, at 9:49, Motti Shneor <motti.shneor@gmail.com> wrote:

Hi, thanks again ---

I tried your code exactly in a minimal command-line-tool XCode target I created,  and I also set the DC1394_DEBUG environment variable for better logging of libdc1394. Here is the output of the program:

libdc1394 debug: Initializing platform 0: macosx
libdc1394 debug: Initialized platform 0
libdc1394 debug: Enumerating cameras...
libdc1394 debug: Enumerating platform macosx
libdc1394 debug: Platform macosx has 1 device(s)
libdc1394 debug: Got 22 quads of config ROM
libdc1394 error: No cameras found

I wonder how is it "Platform macosx has 1 device(s)" but still no cameras are found. And also what does "Got 22 quads of config ROM" mean.

Documentation anywhere?


So it sees a firewire camere, read the ROM (quads are defined as uint32_t * quads).
The code displaying this message is in libdc1394/dc1394/enumeration.c

most of the doc is here :
http://damien.douxchamps.net/ieee1394/libdc1394/

Looks like we can read the ROM but it doesn’t report some feature expected by the lib.

Rodolphe





On 7 בינו 2014, at 17:36, Rodolphe Pineau wrote:

I already replied to you almost a week ago but in case you missed it :

I think the problem is with the way you access cameraList->ids .. this returns a pointer… to the list
Here is the code I use to list cameras :


-(void)listCam
{
uint16_t i;
dc1394_t * d;
dc1394camera_list_t * list;
dc1394error_t err;
dc1394camera_t *camera;

d = dc1394_new ();
if (!d)
    return ;
err=dc1394_camera_enumerate (d, &list);
DC1394_ERR(err,"Failed to enumerate cameras");

if (list->num == 0) {
    dc1394_log_error("No cameras found");
    return ;
}
for(i=0; i<list->num; i++) {
    camera = dc1394_camera_new (d, list->ids[i].guid);
    if (!camera) {
        dc1394_log_error("Failed to initialize camera with guid %"PRIx64, list->ids[i].guid);
        dc1394_camera_free_list (list);
        return;
    }

    printf("camera %u : %s %s\n", i, camera->vendor, camera->model);
    dc1394_camera_free(camera);
}
dc1394_camera_free_list (list);
dc1394_free (d);

}

Regards, Rodolphe

On Tue 1/7/14, at 4:44, Motti Shneor <motti.shneor@gmail.com> wrote:

Hi.

I'm new to libdc1394, and I'm experiencing problems working with an old (but supported) camera - PixeLink PL-A662.
I managed to build libdc1394 on my MacOS 10.7.5. I then tried a very simple test program that should only identify and log a list of attached cameras:

#include <dc1394/dc1394.h>
int main() {
 dc1394_t* _driver = dc1394_new();
 dc1394camera_list_t* cameraList = NULL;
 dc1394camera_t* currentCamera = NULL;
 dc1394camera_id_t* cameraId = NULL;    
 // enumerate found cameras.
 if(_driver) {
     dc1394_camera_enumerate(_driver, &cameraList);
     if(cameraList)  {
         for(int i = 0; i < cameraList->num; i++) {
             cameraId = cameraList->ids;
             currentCamera = dc1394_camera_new(_driver, cameraId->guid);
             if(currentCamera) {
                 NSLog(@"\nvendor : \"%s\"\nmodel : \"%s\" \nguid : \"%llx\"", currentCamera->vendor, currentCamera->model, currentCamera->guid);
                 dc1394_camera_free(currentCamera);
             }
         }
         dc1394_camera_free_list(cameraList);
     }
     dc1394_free(_driver);
_driver = NULL;
 }
}

The program does NOT identify or report the camera.

The camera is connected, and seems to work. Its led lights green as expected. In the Mac's "System Report" I see the device under the FireWire bus:
-----------------------------------
FireWire Bus:
Maximum Speed: Up to 800 Mb/sec
Unknown Device:
Manufacturer: 0x168
GUID: 0x1687300080382
Maximum Speed: Up to 400 Mb/sec
Connection Speed: Up to 400 Mb/sec
Sub-units:
Unknown Unit:
Unit Software Version: 0x103
Unit Spec ID: 0x168
-----------------------------------

In addition, when I boot my Mac from an old MacOS (10.6) which supports PowerPC emulation, I can run the original capture program from PixeLink, and capture images and video from the Camera. Hence --- Camera is alright.


However --- my libdc1394 based test program fails to report it. Specifically in the code above - cameraList->num is 0;
I turned on Debug logging in libdc1394, and I receive the following log:
-----------------------------------
libdc1394 debug: Initializing platform 0: macosx
libdc1394 debug: Initialized platform 0
libdc1394 debug: Enumerating cameras...
libdc1394 debug: Enumerating platform macosx
libdc1394 debug: Platform macosx has 1 device(s)
libdc1394 debug: Got 22 quads of config ROM
-----------------------------------

and that is all. Any idea? Something stupid I've done? What to test next?

Thanks!
Motti Shneor
---------------------------------------------------------
Ceterum censeo Microsoftinem delendam esse


Motti Shneor
e-mail: motti.shneor@gmail.com
phone: +972-8-9267730
mobile: +972-54-3136621
----------------------------------------
Ceterum censeo Microsoftinem delendam esse


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk_______________________________________________
Mailing list for libdc1394-devel
libdc1394-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdc1394-devel

--
|        Rodolphe Pineau    RTI-Zone        |
|         http://www.rti-zone.org/          |
|   Robotics / Unix / Mac OS X / Astronomy  |


Motti Shneor
e-mail: motti.shneor@gmail.com
phone: +972-8-9267730
mobile: +972-54-3136621
---------------------------------------------------------
Ceterum censeo Microsoftinem delendam esse





--
|        Rodolphe Pineau    RTI-Zone        |
|         http://www.rti-zone.org/          |
|   Robotics / Unix / Mac OS X / Astronomy  |


Motti Shneor
e-mail: motti.shneor@gmail.com
phone: +972-8-9267730
mobile: +972-54-3136621
---------------------------------------------------------
Ceterum censeo Microsoftinem delendam esse





------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Mailing list for libdc1394-devel
libdc1394-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdc1394-devel