How to automatically restart a plugin after it fails?


I have a plugin that streams the camera to my website. However, sometimes it crashes. Is there any way to make it so if a plugin fails it automatically restarts?

I couldn’t find anything like that in the docs.

Thank you.

If you’re using the WiFi API, you can start the plug-in through the Wi-Fi API.

I do not think there is anything in the OS to check for a locked plug-in and restart it automatically.

You can use passthrough power from a raspberry pi and then control the plug-in with the USB API if you need to.

As a last resort, you can also reboot the camera with the USB if locks and then start the plug-in again with the USB API.

Mmm I see, I’ll have to use the USB api since I don’t use the other two.

Linked to the question above, sometimes when it fails the camera shuts down. I know its highly unlikely but, is there any way to power on the camera without manual access?

Thank you

Register for this document.

Go to camera section on left.


On the right, select the appropriate device. You will need to connect the camera to something like a Raspberry Pi.

There is also search capability on the document in the upper right, there is a “magnifying glass” icon.

Simple test with remote access to an educational robot.

Note that I’m not 100% sure that there is no way to have a plug-in restart itself. I’ve never heard of a way of doing it. The internal camera OS is Android. If there is an Android technique, it may work for the camera. However, the camera cannot run two plug-ins simultaneously, so I can’t think of a way for the plug-in to check itself if it has crashed.

1 Like

I’ve been trying to start the plugin using usb api, however I founf one problem that I can’t solve.

Using the Theta V, according to this link ( I have to use the command ptpcam -R 0x99AB,1,0,0,0,0 to turn off the plugin and ptpcam -R 0x99AB,0,0,0,0,0 to turn it on.

When I turn it off there is no problem but when I try to turn it on, I get an error with response 0x201d saying that it’s an invalid parameter.

Any idea on what the reason may be?

The device version is 3.50.1 which in theory supports the command

  • I’ll try it and see if I can replicate the problem
  • If I can’t solve it, I’ll ask people at RICOH
  • This may take some time, especially if I need to ask RICOH for help

@jcasman, I’ve added this to our internal discussion agenda. We should track the status so we remember to resolve this. Prior to seeing this issue, I was planning to add this same test to theta_usb_desktop


I’ve just DM’ed @juliette_pepper , can continue the discuss there.

@jcasman, thanks. I think the next step is to try different ptpcam parameters. It’s possible that it’s 0x99ab, 1 without the 0,0,0,0 or that it is 0x99ab,1,0,0 without the last two zeros. I need to boot into Linux to test this. I’ve been using Windows (which I’m using to write this now) in order to sync up my development environment with you.

What you can do is to document the problem and current status of testing. It’s likely that other people have this same requirement to start and stop the plug-in with the USB API. I feel that the main risk is that we forget to test it and followup. The actions we need to remember to do:

  1. test it and document our tests (even if the tests fail)
  2. if we cannot solve the problem, then report to RICOH
  3. if we solve the problem, update the USB API community documentation
  4. decide if we should send out a notice of updated documentation to a few people or a list of registered people in case they are wondering about the same thing

Update Dec 3, 1pm PST.

I can’t start the plug-in.

$ ptpcam -R 0x99AB,0,0,0,0,0 
Sending generic request: reqCode=0x99ab, params=[0x00000000,0x00000000,0x00000000,0x00000000,0x00000000]
PTP: Invalid Parameter
PTP: ERROR: response 0x201d

Test to get plug-in handles.

$ ptpcam -R 0x99A8
Sending generic request: reqCode=0x99a8, params=[0x00000000,0x00000000,0x00000000,0x00000000,0x00000000]
07 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 - ................
03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00 - ................
00 00 00 00 00 00 00 00                         - ........        
PTP: response OK

I can’t figure out how to use the handle.

$ ptpcam -R 0x99A9, 0x00000007, 0,0,0,0
Sending generic request: reqCode=0x99a9, params=[0x00000000,0x00000000,0x00000000,0x00000000,0x00000000]
PTP: Invalid Parameter
PTP: ERROR: response 0x201d