Welcome, Guest
Username: Password: Remember me
27 Feb 2017
INDI development team is happy to announce the release of INDI Library v1.4.0. This new exciting release builds on the maturity of INDI Library and comes with many new supported devices and fixes for existing drivers. Several improvements and enhancements are included in this release including native support for Cygwin and MacOS platforms in addition to Linux, BSD, and Windows (Client only).
Read More...
  • Page:
  • 1
  • 2

TOPIC: Using a starlight camera with a c++ program

Using a starlight camera with a c++ program 1 month 1 week ago #16860

  • Ben
  • Ben's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
I'm trying to write a C++ program that can communicate with a Starlight Xpress Ultrastar camera and tell it to take a picture. I'm using a linux vm right now but the final product will be running on a raspberry pi zero. Can the Starlight Xpress driver be used directly from a C++ program? If I can do this from a C++ program then how would I get started? And do I have to first run the indiserver command in the terminal for the driver to work or can it be done without starting a server? I'm new to pretty much all of this so as much information as possible, even if it seems basic, would be extremely helpful.

Please Log in or Create an account to join the conversation.

Using a starlight camera with a c++ program 1 month 1 week ago #16862

Well, there are many ways to do it. You can adapt the existing driver to your needs and take photos with it (no need for INDI or INDI server), or you can write an a simple INDI client (if you plan to use indiserver), or use indi_getprop/indi_setprop commands from any program.

Please Log in or Create an account to join the conversation.

Using a starlight camera with a c++ program 1 month 6 days ago #16869

Ben, as Jasem wrote, it is not necessary to use INDI for this at all. Look at sxccdtest ( github.com/indilib/indi/blob/master/3rdp...ndi-sx/sxccdtest.cpp ) for example how to use interface library ( github.com/indilib/indi/blob/master/3rdp...indi-sx/sxccdusb.cpp ) directly. Peter

Please Log in or Create an account to join the conversation.

Using a starlight camera with a c++ program 1 month 5 days ago #16904

  • Ben
  • Ben's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
Thanks for the links! I hadn't had any luck finding the driver source code since I accidentally overlooked the 3rd party folder of the git repo. I was able to get the sxccdtest file running, and it correctly identified the connected device as an ultrastar camera! The only issue is that a lot of the tests output LIBUSB_ERROR_IO. For example the output from the get camera model portion reads as follows:

sxGetCameraModel: libusb_control_transfer -> LIBUSB_ERROR_IO
sxGetCameraModel: libusb_control_transfer -> LIBUSB_ERROR_IO
sxGetCameraModel: INTERLACED COLOR model 16
sxGetCameraModel: -> 36080

Have you seen this problem before where most of the tests have an io error from libusb? From my limited knowledge of usb one thing that seems off is that the output says libusb_control_transfer, but in the source code a bulk transfer is being performed, is that alright?

Also is there any documentation for the driver source files (sxccdusb.ccp/h)? I can follow the code alright, but documentation would help quite a bit. I haven't been able to find any documentation so far. Thanks in advance!

Please Log in or Create an account to join the conversation.

Using a starlight camera with a c++ program 1 month 4 days ago #16909

I suspect that USB device is in read-only mode. Did you installed USB rules?

github.com/indilib/indi/blob/master/3rdp.../indi-sx/99-sx.rules

And yes, it is historical typo in the source code, it is actually bulk transfer :) Peter

Please Log in or Create an account to join the conversation.

Using a starlight camera with a c++ program 1 month 4 days ago #16922

  • Ben
  • Ben's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
I tried copying the 99-sx.rules file into /etc/udev/rules.d but I still get the libusb io errors when I run the test program. Is that the proper way to install the USB rules? I'm not familiar with .rules files so I'm just going off of what I could find online.

Please Log in or Create an account to join the conversation.

Using a starlight camera with a c++ program 1 month 4 days ago #16924

Maybe try /lib/udev/rules.d instead and reload rules by "sudo udevadm control --reload-rules" command. Peter

Please Log in or Create an account to join the conversation.

Using a starlight camera with a c++ program 1 month 3 days ago #16936

  • Ben
  • Ben's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
I tried copying the 99-sx.rules file into /lib/udev/rules.d instead and ran the reload rules command, but no such luck. I still get a lot of libsub IO errors. I tried deleting the 99-sx.rules file from /etc/udev/rules.d just to make sure they weren't somehow interfering with each other, but still nothing. I'll be looking into libusb to see if I can get more information about the error for troubleshooting. If you have any more suggestions they would be greatly appreciated!

Please Log in or Create an account to join the conversation.

Using a starlight camera with a c++ program 1 month 2 days ago #16945

This usually means, that device is readonly and this situation should be handled by usb rules. Try to find device in /dev/bus/usb/XX/YY to check if you have write access. Alternatively you can try to run your code as root to make sure that this is the reason. Peter

Please Log in or Create an account to join the conversation.

Using a starlight camera with a c++ program 4 weeks 11 hours ago #17026

  • Ben
  • Ben's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
I've tried running sudo ./a.out, and I still get LIBUSB_ERROR_IO every time a bulk transfer is attempted, and whatever data I do get back is all garbage data that is inconsistent between runs of the program. I noticed that the 99-sx.rules file didn't have a line with the PID for an ultrastar so I created a line for that matching the VID and PID to an ultrastar. Still no luck there. I navigated there and unplugged and re-plugged in the camera and identified the new file, and viewed the file properties and under the permissions tab is says Owner: root and Access: read and write. The read and write part is part of a drop down box that cannot be edited. So, assuming that's a proper check for read/write access, does that mean that the device is write-able and that the issue lies elsewhere?

Please Log in or Create an account to join the conversation.

Using a starlight camera with a c++ program 4 weeks 10 hours ago #17028

If it doesn't work with sudo, it is not write access issue. But I don't know what's wrong. Does it work with INDI driver? Are you sure, that there is no other application blocking the access to the camera? Peter

Please Log in or Create an account to join the conversation.

Using a starlight camera with a c++ program 4 weeks 10 hours ago #17030

  • Ben
  • Ben's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
It might be prudent to quickly run through what I've done to make sure I didn't simply overlook something obvious. I copied 99-sx.rules into /etc/udev/rules.d and into /lib/udev/rules.d and reloaded the udev rules using udevadm control --reload-rules. I have downloaded libusb-1.0. After downloading the repo I navigated to the 3rdparty/indi-sx folder and compiled the test program with the following command: g++ sxccdtest.cpp sxccdusb.cpp sxccdusb.h sxconfig.h -lusb-1.0
That compiles successfully and produces the executable a.out. When I run a.out it successfully gets the device descriptor (presumably) because it displays the expected PID and VID along with the camera name 'ultrastar'. Each command in the test program uses a bulk transfer, but each attempt at a bulk transfer results in the libusb io error. All data that is printed on the screen is inconsistent and presumably garbage data. I've attached the output from one of the runs of the program.

Does any step of that process seem off? I'll start looking at how to get the INDI driver running and see if that provides different results.
Attachments:

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Time to create page: 0.247 seconds

Login

3rd Party

Choose from the numerous 3rd party INDI drivers to suit your needs!

Got Problem?

Check out the FAQ, the forum, and the bug tracking system to resolve any issues you might have!
You can also subscribe to INDI newsletter and development mailing lists to get the latest updates on INDI!

Gallery

Replica

Why INDI

Replica