I'll try this evening.
rec2PB abd PB2rec do not work on many cameras.
So, this is what I have :-
void switch_mode(int mode)
{
if ( mode == 0 )
{
PostLogicalEventForNotPowerType(0x1061); // playback
} else if ( mode == 1 )
{
PostLogicalEventForNotPowerType(0x1061); // playback first !
msleep(10);
PostLogicalEventForNotPowerType(0x1065); // then record
msleep(10);
}
}
ptpcam command 'mode 0' when you are already in playback does not produce an error.
'mode 1' switches to record, lens extends and camera turns-off immediately.
From previous experience, the playback mode command when switching to record was needed , I cannot remember why, I will remove it.
For cameras that have a playback pushbutton, I have used the following for PostLogicalEventForNotPowerType :-
RECORD 0x1001
PLAYBACK 0x1003