Do you know power on method from power off state via commands or API

Hi there

I am using Theta V and want to boot the camera from power off state using API and commands.
I was wondering if anyone knows how to do this.

I have confirmed that it is possible to wake up the camera when it is in Sleep using ptpcam and USB API.

I am referring to the following
https://codetricity.github.io/theta-linux/usb_api/#test-ptpcam-response-again
https://api.ricoh/docs/theta-usb-api/property/sleep_mode/

Regards,

Using Raspberry Pi

Camera - RICOH THETA Development on Linux

Using Jetson Nano

Camera - RICOH THETA Development on Linux

Demonstration

1 Like

Thank you so much!!!
Super cool!! :raised_hands:

I’m sorry for repeating myself.

The procedure seems to work on the Theta V because it can recognize the lsusb command even when it is powered off.

I am also using Theta SC2.
In the case of the Theta SC2, it is not recognized by lsusb command in the power off state, and the code does not seem to work.
Is there any other special procedure required for the SC2?

Should I create a new topic for Theta SC2?

I believe you can’t power on an SC2 with this technique. You need to use sleep with the SC2.

1 Like

Thank you for your reply!

If you really need to power off with the SC2, can you post if you need to power it off because:

  1. Sleep is insufficient for power saving. You need to store the camera for several works and then have it turn on

OR

  1. you need to power off and then power on the device if the remote device gets stuck. For example, you are looking for a way to reboot the device when something unexpected happens to your program.

If you have a Raspberry Pi 4, note that for the Z1, Shun Yamashita at fulldepth added this additional solution.

Camera - RICOH THETA Development on Linux

1 Like

It’s actually a scenario similar to number 2.
I am planning to set up a Jetson Nano + Theta V or SC2 in a remote location to shoot video. (Not STREAMING).
In this case, I’m looking for a way to get the Theta back on if it is turned off by someone or unexpectedly.

By the way, I understand that the way to restore the power is like the --reset-usb option of usb_modeswitch command for USB Hub.
When I do this to the USB Hub with Theta V plugged in, the power button on Theta V seems to go from green to unlit.
Is there some sort of auto-start setting that I need to configure on the Theta itself?

I am using the following Anker USB3.0 Hub and have only one Theta connected to it.

It has the same Realtec VID and PID as the USB3.0 Hub described in the article.

To me it looks like the difference between these USB Hubs is whether they have a power adapter or not. Could it be related to the event posted above?

Can you plug the RICOH THETA V directly into the Jetson Nano USB port on the Nano and then use another port for the HUB and your other peripherals?

The Jetson Nano can power the THETA V over the USB cable without a powered hub as long as you’re not streaming in 4K (which you’re not).

There is no configuration on the THETA V. The technique will not work on the SC2.

I am not familiar with usb_modeswitch.

This technique with the USB cable to power on the device is not in the official RICOH documentation and is a community workaround. I’m not sure what is actually happening with the camera. However, if you physically unplug and plug the USB cable into a PC/Mac/Nano or other device then you can see that the camera will turn on. It must be in a power off state (not sleep).

Based on this behavior, we can work backwards and try to replicate the unplug and plug-in behavior in software. There is no configuration on the THETA V needed, but we also don’t know what is being sent to the camera over the USB cable for it to turn on. I think it is just an electrical signal, not data.

The test below is done with a Jetson Nano on a “toy” robot to simulate industrial use.

There is a separate Windows kiosk that is connected to the network. I’m using ssh from the Windows PC to send a command to the Jetson Nano to control the RICOH THETA Z1, including power on. In this demo, the Jetson is connected to the network with Wi-Fi.

The small application that I used is below.

/**************** 
* Tested on Jetson Nano running JetPack 4.4
* The RICOH THETA V and Z1 will turn on from a power off state when 
* the USB cable is plugged into a port. This example  will power cycle
* the USB ports of the Nano.  You must have libusb-1.0-0-dev installed
* on the Nano and link to it.
* 
* Additional information on using libusb_control_transfer is below. 
* https://www.cs.unm.edu/~hjelmn/libusb_hotplug_api/group__syncio.html
*****************/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <libusb-1.0/libusb.h>

unsigned        vid = 0x0bda;
unsigned        pid = 0x5411;


int power_cycle(libusb_device_handle *hub_devh)
{
        int ret = -1;

        /*ep0 vendor command enable*/
        ret = libusb_control_transfer(hub_devh, 0x40, 0x02, 0x01, ((0x0B<<8)|(0xDA)), 0, 0, 100000);
        if (ret < 0) {
                printf("[error]:ep0 vendor command enable fail.\n");
                return ret;
        }

        /*ep0 vendor command disable*/
        libusb_control_transfer(hub_devh, 0x40, 0x1, 0x08, 0, NULL, 0, 100);
        libusb_control_transfer(hub_devh, 0x40, 0x3, 0x08, 0, NULL, 0, 100);
        libusb_control_transfer(hub_devh, 0x40, 0x02, 0x00, ((0x0B<<8)|(0xDA)), 0, 0, 100000);

        return ret;
}

int main(int argc, char *argv[])
{
    int ret=0;
    libusb_device_handle    *hub_devh;
    libusb_context      *context;

    ret = libusb_init(&context);
    if (ret != 0){
        printf("[error]:libusb init fail.\n");
        return ret;
    }

    hub_devh = libusb_open_device_with_vid_pid(context, vid, pid);
    if (!hub_devh) {
        printf("[error]:open device %04x:%04x fail.\n", vid, pid);
        return -1;
    }
    ret = power_cycle(hub_devh);
    return ret;
}

build

$ sudo apt-get install libusb-1.0-0-dev
$ gcc -o power_cycle reset_jetson_usb_power.c -lusb-1.0
$ sudo ./power_cycle

I’ve done some additional testing with the SC2 and the SC2 may also power on. I guess I just assumed it wouldn’t work and all the interest was in live streaming, so I never tested it.

In my tests, the USB API to shutdown the SC2 does not work. I did more tests and the SC2 can turn over the USB cable, but it is not as straightforward as the Z1. I am making a video to summarize my findings.

Thank you for your reply.
Also, thanks for the best validation.

The video is easy to understand. I will take a video next time too.
I guess it depends on how you do it, but I found that SC2 is not suitable for remote control.

The following method did not work in the end and Theta did not boot, so I decided to recreate the same situation by remotely Rebooting Jetson, as expected with reset_jetson_usb_power.c and usb_modeswitch.

I’m going to try replacing the USB hub with the same one to see if that helps.

1 Like

In the discussion below, there are also two ways to wake the THETA V from sleep with the USB API.

RICOH THETA API Over USB Cable - (Z1, V, S, SC models) - #116 by Hugues

These two techniques work with the THETA V firmware 3.70.1.

If this is for a one-time project, try looking for a used THETA V on eBay or equivalent.

If this is for a potential high-volume project, contact @jcasman for further discussion.

For a one-time project, you should be able to find a THETA V for less than USD $300 used.