mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-06 21:21:17 -07:00
Minor fixes, added some functionality to send data, but still some way to go
This commit is contained in:
parent
5b760b6cac
commit
96e7a3a50b
2 changed files with 19 additions and 6 deletions
|
@ -218,7 +218,7 @@ int CmdRun(const char *Cmd)
|
||||||
char buf[256];
|
char buf[256];
|
||||||
snprintf(buf, sizeof buf, "./scripts/%s", cmd_name);
|
snprintf(buf, sizeof buf, "./scripts/%s", cmd_name);
|
||||||
|
|
||||||
printf("Executing file '%s'\n---------------------------\n" , cmd_name);
|
printf("-----Executing file '%s'\n" , cmd_name);
|
||||||
// run the Lua script
|
// run the Lua script
|
||||||
|
|
||||||
int error = luaL_loadfile(lua_state, buf);
|
int error = luaL_loadfile(lua_state, buf);
|
||||||
|
@ -241,6 +241,6 @@ int CmdRun(const char *Cmd)
|
||||||
//luaL_dofile(lua_state, buf);
|
//luaL_dofile(lua_state, buf);
|
||||||
// close the Lua state
|
// close the Lua state
|
||||||
lua_close(lua_state);
|
lua_close(lua_state);
|
||||||
printf("-----------------Finished\n");
|
printf("\n-----Finished\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,23 @@ static int l_SendCommand(lua_State *L){
|
||||||
==> A 544 byte buffer will do.
|
==> A 544 byte buffer will do.
|
||||||
**/
|
**/
|
||||||
//Pop cmd
|
//Pop cmd
|
||||||
UsbCommand *c = (UsbCommand *)lua_touserdata(L, 1);
|
size_t size;
|
||||||
luaL_argcheck(L, c != NULL, 1, "'UsbCommand' expected");
|
const char *data = luaL_checklstring(L, 1, &size);
|
||||||
SendCommand(c);
|
if(size != sizeof(UsbCommand))
|
||||||
|
{
|
||||||
|
printf("Got data size %d, expected %d" , size,sizeof(UsbCommand));
|
||||||
|
lua_pushstring(L,"Wrong data size");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UsbCommand c = (*data);
|
||||||
|
SendCommand(data);
|
||||||
return 0;
|
return 0;
|
||||||
|
//UsbCommand *c = (UsbCommand *)lua_touserdata(L, 1);
|
||||||
|
//luaL_argcheck(L, c != NULL, 1, "'UsbCommand' expected");
|
||||||
|
|
||||||
|
//SendCommand(c);
|
||||||
|
//return 0;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief The following params expected:
|
* @brief The following params expected:
|
||||||
|
@ -59,7 +72,7 @@ static int l_WaitForResponseTimeout(lua_State *L){
|
||||||
printf("in l_WaitForResponseTimeout, got cmd 0x%0x\n",(int) cmd);
|
printf("in l_WaitForResponseTimeout, got cmd 0x%0x\n",(int) cmd);
|
||||||
//UsbCommand response;
|
//UsbCommand response;
|
||||||
|
|
||||||
//We allocate the usbcommand as userdata on the Lua-stack
|
//We allocate the usbcommand as userdata on the Lua-stack
|
||||||
size_t nbytes = sizeof(UsbCommand);
|
size_t nbytes = sizeof(UsbCommand);
|
||||||
|
|
||||||
UsbCommand *response = (UsbCommand *)lua_newuserdata(L, nbytes);
|
UsbCommand *response = (UsbCommand *)lua_newuserdata(L, nbytes);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue