Getting the Test Application to Work
Should be easy, right? Delete the object files, recompile, run.
Well, not quite. As the README will point out, you need to copy the shared objects (libraries) to a "global" location, /usr/local/lib is recommended. Also, due to the way one(?) of them was linked, it requires that libusb.so be in /usr/local/lib. The recommended way to "fix" that is to create a symbolic link from /usr/local/lib/libusb.so to where the real library is, which should be /usr/lib/libusb.so.
After doing that, you will need to run ldconfig to rebuild the cache of library locations. This happens automatically on reboot, so this step is a once-only and only required to access everything immediately. You may also need to add /usr/local/lib to the set of directories searched by ldconfig. Fedora Core 5 does not search there by default. To do this, I added a file /etc/ld.conf.d/local.config with the single line "/usr/local/lib" before running ldconfig. Okay, let's recapitulate:
- Copy the SBIG shared libraries (".so" files) to /usr/local/lib.
- Create the symbolic link, cd /usr/local/lib; ln -s /usr/lib/libusbs.so .
- Create the file /etc/ld.config.d/local.config with the one line "/usr/local/lib".
- Run ldconfig.
Now you're ready to delete those object files (".o" files) and rebuild the test application.
Sigh. Well, it turns out there is a bug somewhere that causes the attempt to establish a link to the camera to fail randomly. It usually succedes, but sometimes fails. Once it fails, it is often hard to get out of that state using the supplied code. It turns out that the "fix" is simple: try again. So, in the file csbigcam.cpp, change the method EstablishLink(void) to read as follows:
PAR_ERROR CSBIGCam::EstablishLink(void)
PAR_ERROR res;
EstablishLinkResults elr;
EstablishLinkParams elp;
/* For reasons unknown at present, a single attempt to establish the
link may fail. But it seems to always work within 5 tries. Be
generous and give it 10. */
for (int i = 0; i < 10; i++) {
res = SBIGUnivDrvCommand(CC_ESTABLISH_LINK, &elp, &elr);
if ( res == CE_NO_ERROR ) {
m_eCameraType = (CAMERA_TYPE) elr.cameraType;
return res;
}
cout << "failed to establish link, will try again" << endl;
// sleep(1);
}
return res;
}
The above is not required if you are using the version of the libraries distributed by Jan Soldan (and hopefully soon by SBIG) but does not real harm either. Jan has worked with SBIG to get libsbigudrv.so modified to include the retry logic directly. Without that, every application that connects to the camera would need to do something like the above.
Now you're almost ready to recompile. The file testapp_main.cpp establishes two camera connections, one via USB and one via LPT. Since I'm only dealing with the USB camera and since it is unlikely that you have both connected, edit that file and remove everything referencing the LPT camera.
Now you're ready to recompile. Reality check---fix your compilation errors. Then you should be able to run "./testapp" and be rewarded with output that looks something like this:
278 roland> ./testapp
Creating the SBIGCam Object on USB...
Establishing a Link to the USB Camera...
Link Established to Camera Type: ST-7
Taking light image on USB...
Saving compressed image...
Closing Devices...
Closing Drivers...
SUCCESS
Hit any key to continue:
WARNING: The INDI 0.4 release includes a dummy driver for libsbigudrv.so in order to be able to compile. The driver can be overwritten with the real driver after installing INDI and everything will work. Unfortunately, if you install the library before installing INDI 0.4, the latter will overwrite your good library with the dummy version. This has been fixed in subversion and will certainly be part of the 0.5 release.
- Printer-friendly version
- Login to post comments


