SWIG experiments
Squash of the following commits (a full rebase was too hard :( ) * ef309cfdf N - SWIG: create pm3.c (5 months ago) <Philippe Teuwen> * 05ba6a73f N - swig pm3_device -> pm3 (5 months ago) <Philippe Teuwen> * d59630183 N - swig: move pm3.i (5 months ago) <Philippe Teuwen> * 6adcfad75 N - Fix historic make & cmake (5 months ago) <Philippe Teuwen> * bcbef2edf N - Fix typo with script_embedded (5 months ago) <slurdge> * 538ee4dab N - Better SWIG integration: autogen func & attributes (5 months ago) <slurdge> * 756b62466 N - SWIG: few helper scripts (5 months ago) <Philippe Teuwen> * 47ba4acd0 N - SWIG %extend (5 months ago) <Philippe Teuwen> * 21841cb9d N - simplify scripts (5 months ago) <Philippe Teuwen> * 78c4f7929 N - Revert "SWIG experiments: introduce context" (5 months ago) <Philippe Teuwen> * 1562b75fc N - SWIG experiments: introduce context (5 months ago) <Philippe Teuwen> * a503dfcd9 N - SWIG experiments (5 months ago) <Philippe Teuwen>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "uart/uart.h"
|
||||
#include "ui.h"
|
||||
@@ -541,7 +542,7 @@ bool IsCommunicationThreadDead(void) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool OpenProxmark(char *port, bool wait_for_port, int timeout, bool flash_mode, uint32_t speed) {
|
||||
bool OpenProxmark(pm3_device **dev, char *port, bool wait_for_port, int timeout, bool flash_mode, uint32_t speed) {
|
||||
|
||||
if (!wait_for_port) {
|
||||
PrintAndLogEx(INFO, "Using UART port " _YELLOW_("%s"), port);
|
||||
@@ -588,15 +589,17 @@ bool OpenProxmark(char *port, bool wait_for_port, int timeout, bool flash_mode,
|
||||
|
||||
pthread_create(&communication_thread, NULL, &uart_communication, &conn);
|
||||
__atomic_clear(&comm_thread_dead, __ATOMIC_SEQ_CST);
|
||||
session.pm3_present = true;
|
||||
session.pm3_present = true; // TODO support for multiple devices
|
||||
|
||||
fflush(stdout);
|
||||
*dev = malloc(sizeof(pm3_device));
|
||||
(*dev)->conn = &conn; // TODO conn shouldn't be global
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// check if we can communicate with Pm3
|
||||
int TestProxmark(void) {
|
||||
int TestProxmark(pm3_device *dev) {
|
||||
|
||||
PacketResponseNG resp;
|
||||
uint16_t len = 32;
|
||||
@@ -659,8 +662,8 @@ int TestProxmark(void) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
void CloseProxmark(void) {
|
||||
conn.run = false;
|
||||
void CloseProxmark(pm3_device *dev) {
|
||||
dev->conn->run = false;
|
||||
|
||||
#ifdef __BIONIC__
|
||||
if (communication_thread != 0) {
|
||||
|
||||
Reference in New Issue
Block a user