Patch Camera Remote View

From WebOS Internals
(Redirected from Camera Remote View)
Jump to navigation Jump to search


Goal: To be able to remote into the Pre over EV-DO and grab a current snapshot from the camera...good for many reasons. ;)

Prerequisites:

1. Access Linux on your Pre.

2. Optware & DropBear SSH on the Pre (allowing SSH / SFTP over EV-DO).

3. Dynamic DNS Updater on the Pre.

4. The ability to access the Pre's USB Partition from SFTP.

Once these prerequisites are met, you should be able to SSH / SFTP into your Pre from EV-DO wherever the Pre is and check the camera contents...

Steps for enabling Camera Remote View:

1. This part we still need: A PuTTY or SSH command for snapping a photo. Here's what I have so far:

Example: This will start the cam app remotely. What we need is a command for starting the Camera app, and forcing it to take a snapshot.

luna-send -n 1 palm://com.palm.applicationManager/launch {\"id\":\"com.palm.app.camera\"}
  • Note: May want to do this with sounds disabled or even the camera app not opening at all. Think about making it as inconspicuous as possible, if possible. ~ ultraBlack

2. Once you force the Camera to take a picture, use SFTP to access /media/internal/DCIM and grab the files.

This will allow us to use the Pre as a constant recording device that uploads pictures non-stop to an FTP or similar. The uses for this are numerous.

Join in the IRC to help out!

Alternative technique:

This technique allows you to stream semi-realtime image captures from your phone by leaving a modified version of the stock Camera application running.

1. Set up remote SSH access for your phone, using dropbear or OpenSSH.

2. Create a private/public encryption key pair on your desktop PC or server.

3. Add that public key to the .ssh/allowed_keys file in your home directory on the Pre so that you can SSH into your phone without a password (using the private key).

4. Create a small shell script in your home directory on the Pre called 'capture_photo.sh' with the following contents:

#!/bin/sh
cp /tmp/capture.jpg /tmp/latest_capture.jpg

5. Create a small shell script on your desktop PC named 'download_photo.sh' with the following contents:

#!/bin/sh
ssh -i <private key file> -P <phone SSH port> <phone username>@<phone IP> ~/capture_photo.sh
scp -i <private key file> -P <phone SSH port> <phone username>@<phone IP>:/tmp/latest_capture.jpg ~/latest_capture.jpg

6. Modify the stock Camera application as follows:

 Add an 'automatic capture' flag to the camera controller that causes it to repeatedly call the 'capture' function using setTimeout.
 Change the code used for selecting photo filenames so that it always uses the filename '/tmp/capture.jpg' while in automatic capture mode.

7. At this point, you can start the modified Camera application in automatic capture mode and have it begin capturing frames. You can then use the download_photo script to pull the current frame onto your desktop PC.

I'll be posting the full source code for this technique later - I still need to work out some bugs (experts may note that there's a race condition in the capture_photo script that can result in you getting a mangled photo file.)


one cool thing to do would be to make it so the camera will snap a picture when it detects light. Here's why. Say somebody steals your phone, and you have this script running (maybe even the GPS locating script). Most of the time the person will keep the phone in their pocket, so having the phone take random pictures would be silly and a waste of battery/space/time. If we could make it so the camera took a picture when it noticed light (the phone is taken out of the pocket), then we would be more likely to get a meaningful picture. -- palmkernel (jwborc39963)