mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-12 18:25:07 +08:00
chg: allow to download ´lf config´ settings to client
This commit is contained in:
parent
201f4acb8f
commit
b6dcfbf078
5 changed files with 32 additions and 4 deletions
|
@ -721,10 +721,17 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
setT55xxConfig(packet->oldarg[0], (t55xx_configurations_t *) packet->data.asBytes);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_SAMPLING_GET_CONFIG: {
|
||||
case CMD_LF_SAMPLING_PRINT_CONFIG: {
|
||||
printConfig();
|
||||
break;
|
||||
}
|
||||
case CMD_LF_SAMPLING_GET_CONFIG: {
|
||||
sample_config *c;
|
||||
c = getSamplingConfig();
|
||||
Dbprintf("CMD_LF_SAMPLING_GET_CONFIG - before answer");
|
||||
reply_ng(CMD_LF_SAMPLING_GET_CONFIG, PM3_SUCCESS, (uint8_t *)c, sizeof(sample_config));
|
||||
break;
|
||||
}
|
||||
case CMD_LF_SAMPLING_SET_CONFIG: {
|
||||
sample_config c;
|
||||
memcpy(&c, packet->data.asBytes, sizeof(sample_config));
|
||||
|
|
|
@ -81,7 +81,7 @@ void setSamplingConfig(sample_config *sc) {
|
|||
printConfig();
|
||||
}
|
||||
|
||||
sample_config *getSamplingConfig() {
|
||||
sample_config *getSamplingConfig(void) {
|
||||
return &config;
|
||||
}
|
||||
|
||||
|
|
|
@ -457,6 +457,25 @@ int CmdFlexdemod(const char *Cmd) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int lf_getconfig(sample_config *config) {
|
||||
if (!session.pm3_present) return PM3_ENOTTY;
|
||||
|
||||
if (config == NULL)
|
||||
return PM3_EINVARG;
|
||||
|
||||
clearCommandBuffer();
|
||||
|
||||
SendCommandNG(CMD_LF_SAMPLING_GET_CONFIG, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
if (!WaitForResponseTimeout(CMD_LF_SAMPLING_GET_CONFIG, &resp, 2000)) {
|
||||
PrintAndLogEx(WARNING, "command execution time out");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
config = (sample_config *) resp.data.asBytes;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int lf_config(sample_config *config) {
|
||||
if (!session.pm3_present) return PM3_ENOTTY;
|
||||
|
||||
|
@ -464,7 +483,7 @@ int lf_config(sample_config *config) {
|
|||
if (config != NULL)
|
||||
SendCommandNG(CMD_LF_SAMPLING_SET_CONFIG, (uint8_t *)config, sizeof(sample_config));
|
||||
else
|
||||
SendCommandNG(CMD_LF_SAMPLING_GET_CONFIG, NULL, 0);
|
||||
SendCommandNG(CMD_LF_SAMPLING_PRINT_CONFIG, NULL, 0);
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -34,5 +34,6 @@ int CmdLFfind(const char *Cmd);
|
|||
|
||||
int lf_read(bool verbose, uint32_t samples);
|
||||
int lf_config(sample_config *config);
|
||||
int lf_getconfig(sample_config *config);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -392,7 +392,8 @@ typedef struct {
|
|||
#define CMD_LF_T55XX_WAKEUP 0x0224
|
||||
#define CMD_LF_COTAG_READ 0x0225
|
||||
#define CMD_LF_T55XX_SET_CONFIG 0x0226
|
||||
#define CMD_LF_SAMPLING_GET_CONFIG 0x0227
|
||||
#define CMD_LF_SAMPLING_PRINT_CONFIG 0x0227
|
||||
#define CMD_LF_SAMPLING_GET_CONFIG 0x0228
|
||||
|
||||
#define CMD_LF_T55XX_CHK_PWDS 0x0230
|
||||
#define CMD_LF_T55XX_DANGERRAW 0x0231
|
||||
|
|
Loading…
Reference in a new issue