Changeset 1005


Ignore:
Timestamp:
12/19/10 21:35:37 (2 years ago)
Author:
reyalP
Message:

add PTP ScriptStatus? and ScriptSupport? commands, based on patch from ultimA in http://chdk.setepontos.com/index.php?topic=5793.msg57788#msg57788 with some modifications
updated CHDK ptp protocol minor to 0.2
ScriptStatus? returns a bitmask of status values. Bit 0 of param 1 is set if script is running, otherwise cleared
ScriptSupport? returns a bitmask of supported scripting interfaces. Bit 0 of param 1 is set if Lua is supported, otherwise cleared
Values of other bits or params can be added as a minor protocol change.

Location:
trunk/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/ptp.c

    r1000 r1005  
    117117      ptp.param2 = PTP_CHDK_VERSION_MINOR; 
    118118      break; 
    119  
     119    case PTP_CHDK_ScriptSupport: 
     120      ptp.num_param = 1; 
     121      ptp.param1 = PTP_CHDK_SCRIPT_SUPPORT_LUA; 
     122      break; 
     123    case PTP_CHDK_ScriptStatus: 
     124      ptp.num_param = 1; 
     125      ptp.param1 = script_is_running()?PTP_CHDK_SCRIPT_STATUS_RUN:0; 
     126      break; 
    120127    case PTP_CHDK_GetMemory: 
    121128      if ( param2 == 0 || param3 < 1 ) // null pointer or invalid size? 
  • trunk/core/ptp.h

    r957 r1005  
    66 
    77#define PTP_CHDK_VERSION_MAJOR 0  // increase only with backwards incompatible changes (and reset minor) 
    8 #define PTP_CHDK_VERSION_MINOR 1  // increase with extensions of functionality 
     8#define PTP_CHDK_VERSION_MINOR 2  // increase with extensions of functionality 
     9/* 
     10protocol version history 
     110.1 - initial proposal from mweerden, + luar 
     120.2 - Added ScriptStatus and ScriptSupport, based on work by ultimA 
     13*/ 
    914 
    1015#define PTP_OC_CHDK 0x9999 
     
    3439                            // param2 is language of script 
    3540                            // param3 is for the ES flags below 
     41  PTP_CHDK_ScriptStatus,        // Script execution status 
     42                            // param1 CHDK_PTP_SCRIPT_STATUS_RUN is set if a script running, cleared if not 
     43                                                        // all other bits and params are reserved for future use 
     44  PTP_CHDK_ScriptSupport,   // Which scripting interfaces are supported in this build 
     45                            // param1 CHDK_PTP_SUPPORT_LUA is set if lua is supported, cleared if not 
     46                                                        // all other bits and params are reserved for future use 
    3647} ptp_chdk_command; 
    3748 
     
    6273                                   // and integers) or length (strings) 
    6374 
    64 // Script Languages 
     75// Script Languages - for execution 
    6576#define PTP_CHDK_SL_LUA    0 
    6677#define PTP_CHDK_SL_UBASIC 1 
    6778 
     79// bit flags for script status 
     80#define PTP_CHDK_SCRIPT_STATUS_RUN   0x1 
     81// bit flags for scripting support 
     82#define PTP_CHDK_SCRIPT_SUPPORT_LUA  0x1 
     83 
    6884#endif // __PTP_H 
Note: See TracChangeset for help on using the changeset viewer.