示例#1
0
void life_cycle() {

  fprintf(stderr, "Beginning life cycle\n");

        if (!dev_name) {
          if (vendor >= 0 || product >= 0) {
            if (vendor < 0 || product < 0) {
              err("Either give both vendor and product ID or none");
            }
            int dev_id = find_camera(vendor, product);
            if (dev_id >= 0) {
              snprintf(dev_name_buf, FULLNAME_MAX_LEN, "/dev/video%d", dev_id);
              dev_name = &dev_name_buf[0];
            } else {
              err("Could not find device");
            }
          } else {
            dev_name = "/dev/video0";
          }
        }
        fprintf(stderr, "Using device %s\n", dev_name);

        open_device();
        init_device();
        start_capturing();
        mainloop();
        stop_capturing();
        uninit_device();
        close_device();

  fprintf(stderr, "Finishing life cycle\n");

}
示例#2
0
int  qhy5ii_iscamera()
{
	return find_camera(VENDOR_ID, PRODUCT_ID);
}