Commit 64b3488d authored by hudson@kremvax.wan's avatar hudson@kremvax.wan
Browse files

Remote start/stop works!

- Merged PTP_HANDLER and prototype into REGISTER_PTP_HANDLER
- Added remote read/write commands
- Added remote start/stop
parent 78e97b1af757
......@@ -346,19 +346,7 @@ focus_init( void )
}
static int
ptp_lens_focus(
void * priv,
struct ptp_context * context,
uint32_t opcode,
uint32_t session,
uint32_t transaction,
uint32_t param1,
uint32_t param2,
uint32_t param3,
uint32_t param4,
uint32_t param5
)
PTP_HANDLER( 0x9998, 0 )
{
struct ptp_msg msg = {
.id = PTP_RC_OK,
......@@ -377,8 +365,5 @@ ptp_lens_focus(
}
PTP_HANDLER( 0x9998, ptp_lens_focus, 0 );
INIT_FUNC( __FILE__, focus_init );
......@@ -14,19 +14,8 @@
#include "property.h"
#include "lens.h"
static int
ptp_handler_9999(
void * priv,
struct ptp_context * context,
uint32_t opcode,
uint32_t session,
uint32_t transaction,
uint32_t param1,
uint32_t param2,
uint32_t param3,
uint32_t param4,
uint32_t param5
)
PTP_HANDLER( 0x9999, 0 )
{
struct ptp_msg msg = {
.id = PTP_RC_OK,
......@@ -89,9 +78,85 @@ ptp_handler_9999(
}
PTP_HANDLER( 0x9999, ptp_handler_9999, 0 );
/** Start recording when we get a PTP operation 0x9997 */
PTP_HANDLER( 0x9997, 0 )
{
if( param1 == 0 )
call( "MovieStop" );
else
call( "MovieStart" );
struct ptp_msg msg = {
.id = PTP_RC_OK,
.session = session,
.transaction = transaction,
.param_count = 1,
.param = { param1 },
};
context->send(
context->handle,
&msg
);
return 0;
}
/** Dump memory */
PTP_HANDLER( 0x9996, 0 )
{
const uint32_t * const buf = (void*) param1;
struct ptp_msg msg = {
.id = PTP_RC_OK,
.session = session,
.transaction = transaction,
.param_count = 5,
.param = {
buf[0],
buf[1],
buf[2],
buf[3],
buf[4],
},
};
context->send(
context->handle,
&msg
);
return 0;
}
/** Write to memory, returning the old value */
PTP_HANDLER( 0x9995, 0 )
{
uint32_t * const buf = (void*) param1;
const uint32_t val = (void*) param2;
const uint32_t old = *buf;
*buf = val;
struct ptp_msg msg = {
.id = PTP_RC_OK,
.session = session,
.transaction = transaction,
.param_count = 2,
.param = {
param1,
old,
},
};
context->send(
context->handle,
&msg
);
return 0;
}
static void
ptp_state_display(
......@@ -151,4 +216,5 @@ ptp_init( void )
menu_add( "PTP", ptp_menus, COUNT(ptp_menus) );
}
INIT_FUNC( __FILE__, ptp_init );
......@@ -99,7 +99,7 @@ struct ptp_handler
void * priv;
};
#define PTP_HANDLER( ID, HANDLER, PRIV ) \
#define REGISTER_PTP_HANDLER( ID, HANDLER, PRIV ) \
struct ptp_handler \
__attribute__((section(".ptp_handlers"))) \
__ptp_handler_##ID = { \
......@@ -108,4 +108,21 @@ __ptp_handler_##ID = { \
.priv = PRIV, \
}
#define PTP_HANDLER( ID, PRIV ) \
static int ptp_handler_##ID(); \
REGISTER_PTP_HANDLER( ID, ptp_handler_##ID, PRIV ); \
static int ptp_handler_##ID( \
void * priv, \
struct ptp_context * context, \
uint32_t opcode, \
uint32_t session, \
uint32_t transaction, \
uint32_t param1, \
uint32_t param2, \
uint32_t param3, \
uint32_t param4, \
uint32_t param5 \
) \
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment