From 8a9866cada64f6b5b051d7494bb3ccc28a8e2efd Mon Sep 17 00:00:00 2001 From: laforge Date: Wed, 7 May 2008 10:33:49 +0000 Subject: [PATCH] python update git-svn-id: https://svn.gnumonks.org/trunk/librfid@2098 e0336214-984f-0b4b-a45f-81c69e1f0ede --- python/Makefile | 23 ++++++++++++++++++++--- python/openpcd.c | 47 ----------------------------------------------- python/openpcd.h | 27 --------------------------- 3 files changed, 20 insertions(+), 77 deletions(-) diff --git a/python/Makefile b/python/Makefile index 5a77b15..93a4fe9 100644 --- a/python/Makefile +++ b/python/Makefile @@ -1,17 +1,34 @@ +# Makefile for Python bindings +# (C) 2007-2008 by Kushal Das + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 +# as published by the Free Software Foundation + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + CC=gcc PYTHON=python PREFIX=/usr PYTHON_VER=2.5 PYTHON_INC=$(PREFIX)/include/python$(PYTHON_VER) PYTHON_LIB=$(PREFIX)/lib/python$(PYTHON_VER)/site-packages/ -LIBRFID_DIR=../src/.libs/librfid.la -LIBOPENPCD_DIR=/usr/local/openpcd/lib +LIBRFID_DIR=../src/.libs SOURCE_MAIN=pyrfid.c SOURCES=$(SOURCE_MAIN) openpcd.c INCLUDES=-I$(PYTHON_INC) -I../include/ -I../utils/ CFLAGS=-O3 -Wall $(INCLUDES) -LDFLAGS=-shared -L$(LIBRFID_DIR) -lrfid -L$(LIBOPENPCD_DIR) -lusb -Wl,--rpath -Wl,/usr/local/lib $(LIBS) +LDFLAGS=-shared -L$(LIBRFID_DIR) -lrfid -lusb -Wl,--rpath -Wl,/usr/local/lib $(LIBS) TARGET=$(SOURCE_MAIN:.c=.so) OBJECTS=$(SOURCES:.c=.o) diff --git a/python/openpcd.c b/python/openpcd.c index 4fb086c..94962ab 100644 --- a/python/openpcd.c +++ b/python/openpcd.c @@ -301,25 +301,6 @@ EXPORT int EXPORT_CONVENTION openpcd_write(MIFARE_HANDLE handle,int page,const v return (res<0 && res!=-101) ? PCDERROR_WRITE_FAILED : len; } -EXPORT int EXPORT_CONVENTION openpcd_get_api_version(MIFARE_HANDLE handle, unsigned int *version) -{ - unsigned char b; - struct openpcd_state *state; - - if( !handle || !version ) - return PCDERROR_INVALID_PARAMETER; - state=(struct openpcd_state*)handle; - - b=0; - - if(state->rh->reader->get_api_version(state->rh,&b)<0) - return PCDERROR_READER_VERSION; - else - { - *version=b; - return PCDERROR_NONE; - } -} EXPORT int EXPORT_CONVENTION openpcd_reset_reader(MIFARE_HANDLE handle) { @@ -332,34 +313,6 @@ EXPORT int EXPORT_CONVENTION openpcd_reset_reader(MIFARE_HANDLE handle) return (state->rh->reader->reset(state->rh)<0) ? PCDERROR_WRITE_FAILED : PCDERROR_NONE; } -EXPORT int EXPORT_CONVENTION openpcd_get_environment( - MIFARE_HANDLE handle, - unsigned char count, - unsigned char* data - ) -{ - struct openpcd_state *state; - - if( !handle ) - return PCDERROR_INVALID_PARAMETER; - state=(struct openpcd_state*)handle; - - return (state->rh->reader->get_environment(state->rh,count,data)<0) ? PCDERROR_READ_FAILED : PCDERROR_NONE; -} - -EXPORT int EXPORT_CONVENTION openpcd_set_environment( - MIFARE_HANDLE handle, - unsigned char count, - const unsigned char* data) -{ - struct openpcd_state *state; - - if( !handle ) - return PCDERROR_INVALID_PARAMETER; - state=(struct openpcd_state*)handle; - - return (state->rh->reader->set_environment(state->rh,count,data)<0) ? PCDERROR_WRITE_FAILED : PCDERROR_NONE; -} EXPORT char* EXPORT_CONVENTION openpcd_get_error_text(int error) { diff --git a/python/openpcd.h b/python/openpcd.h index 15a1db3..8f17dc0 100644 --- a/python/openpcd.h +++ b/python/openpcd.h @@ -128,11 +128,6 @@ EXPORT char* EXPORT_CONVENTION openpcd_get_error_text(int error); */ EXPORT int EXPORT_CONVENTION openpcd_get_card_id(MIFARE_HANDLE handle,unsigned int *uid); -/* openpcd_get_api_version: - - Get the USB api version of the reader - */ -EXPORT int EXPORT_CONVENTION openpcd_get_api_version(MIFARE_HANDLE handle,unsigned int *version); /* openpcd_reset_reader: @@ -140,28 +135,6 @@ EXPORT int EXPORT_CONVENTION openpcd_get_api_version(MIFARE_HANDLE handle,unsign */ EXPORT int EXPORT_CONVENTION openpcd_reset_reader(MIFARE_HANDLE handle); -/* openpcd_get_environment - - Store the given data to the nonvolatile reader flash - Returns read data count at index or error code - */ -EXPORT int EXPORT_CONVENTION openpcd_get_environment( - MIFARE_HANDLE handle, - unsigned char count, - unsigned char* data -); - -/* openpcd_set_environment - - Read data from nonvolatile reader flash - Returns written data count at index or error code - */ -EXPORT int EXPORT_CONVENTION openpcd_set_environment( - MIFARE_HANDLE handle, - unsigned char count, - const unsigned char* data -); - #ifdef __cplusplus } #endif/*__cplusplus*/