From 98dd43450302f9d76ab418ece24e5fec778c91a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20K=C3=B6ritz?= Date: Thu, 29 Aug 2019 10:12:56 +0200 Subject: [PATCH] Added firmware command to retrieve firmare info --- README.md | 20 ++++++++++---------- actioncam.go | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 82843aa..9bda5f4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# libipcamera +# actioncam / libipcamera Go Library and command line tool for working with cheap action cameras. @@ -6,7 +6,7 @@ Go Library and command line tool for working with cheap action cameras. | Vendor | Model | Firmware Version | Compatibility | Remarks | |---------------|-------------------|-------------------|-------------------|-----------| -| Campark | ACT76 (Xtreme 2) | r0.5 | Full (tested) | | +| Campark | ACT76 (Xtreme 2) | v1.0 rc5 | Full (tested) | | | TecTecTec | XPro2 | - | Full (untested) | | ## Usage Examples @@ -18,7 +18,7 @@ To view the video use the `camera.sdp` file and open it in a compatible player l The stream is a RTP stream sent to Port 5220 on localhost containing H.264 data in preview resolution as AVP Type 99. ``` -ipcamera +actioncam ``` ### Shooting a still picture @@ -26,7 +26,7 @@ ipcamera To shoot a still picture and save it to SD-Card run the subcommand `still`. ``` -ipcamera still +actioncam still ``` ### Recording Video @@ -35,10 +35,10 @@ To record full resolution video to SD-Card use the subcommands `record` and `sto ``` # Start recording Video -ipcamera record +actioncam record # Stop recording Video -ipcamera stop +actioncam stop ``` ### Fetch the list of files on the SD-Card and download the latest file @@ -47,10 +47,10 @@ The camera can provide a list of files stored on the SD-Card, the `ipcamera` too ``` # List files -ipcamera ls +actioncam ls # Download latest file -ipcamera fetch +actioncam fetch ``` ### Send a RAW packet to the Camera @@ -58,10 +58,10 @@ ipcamera fetch It's possible to send RAW commands to the camera to test new commands and help reverse engineer the protocol. ``` -ipcamera cmd +actioncam cmd # Example (Take a still image) -ipcamera cmd 00A038 192.168.1.1 +actioncam cmd 00A038 192.168.1.1 ``` diff --git a/actioncam.go b/actioncam.go index 89f814f..8b412f7 100644 --- a/actioncam.go +++ b/actioncam.go @@ -97,6 +97,20 @@ func main() { }, } + var version = &cobra.Command{ + Use: "version [Cameras IP Address]", + Short: "Retrieve software version information from the camera", + Args: cobra.ExactArgs(1), + Run: func(cmd *cobra.Command, args []string) { + firmware, err := camera.GetFirmwareInfo() + if err != nil { + log.Printf("ERROR retrieving version info: %s\n", err) + return + } + log.Printf("Firmware Version: %s\n", firmware) + }, + } + var cmd = &cobra.Command{ Use: "cmd [RAW Command] [Cameras IP Address]", Short: "Send a raw command to the camera", @@ -145,6 +159,7 @@ func main() { rootCmd.AddCommand(stop) rootCmd.AddCommand(fetch) rootCmd.AddCommand(record) + rootCmd.AddCommand(version) if err := rootCmd.Execute(); err != nil { log.Println(err)