On 550D ML, it's done like this:
At camera startup, there's a loop which says:
for( ; handler < _ptp_handlers_end ; handler++ )
{
ptp_register_handler(
handler->id,
handler->handler,
handler->priv
);
}
A PTP handler is declared in ML code like this:
PTP_HANDLER( 0x9998, 0 )
{
// code here
}
That macro declares the function like this:
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 \
) \
So, inside the PTP handler, you have access to some parameters of that command.
PTP_HANDLER( 0x9998, 0 )
{
int step = (int) param1;
/* send some focus commands with that step size */
/* which sounds like a remote follow focus */
}