]> hackdaworld.org Git - rfid/librfid.git/commitdiff
*** empty log message ***
authorhackbard <hackbard>
Tue, 21 Mar 2006 23:37:37 +0000 (23:37 +0000)
committerhackbard <hackbard>
Tue, 21 Mar 2006 23:37:37 +0000 (23:37 +0000)
gemtag/gemtag.c

index d6191ba3bb42beed1720f97aeafd7e9ded005635..121170f9c0dafa9da84f03faac256af59fc0adde 100644 (file)
@@ -252,8 +252,18 @@ int gemtag_transform_mifare_key(struct gemtag_handle *gh,
        return 0;
 }
 
+int gemtag_auth_key(struct gemtag_handle *gh,unsigned char authmode,
+                    int sector,unsigned char *key6) {
+
+       unsigned char buf[32];
+       unsigned int len,ret;
+
+       /* to be continued */
+
+}
+
 int gemtag_auth_mifare_key(struct gemtag_handle *gh,
-                    unsigned char *key6,int sector) {
+                           unsigned char *key6,int sector) {
 
        unsigned char key12[12];        
        unsigned char buf[32];
@@ -289,10 +299,9 @@ int gemtag_write16(struct gemtag_handle *gh,int sector,unsigned char *data) {
        unsigned char buf[32];
        int ret,len;
 
-       buf[0]=GEMTAG_PICC_WRITE16;
-       buf[1]=sector;
-       memcpy(buf+2,data,16);
-       ret=gemtag_transceive(gh,GEMTAG_CMD_COMMON_WRITE,buf,18,buf,&len);
+       buf[0]=sector;
+       memcpy(buf+1,data,16);
+       ret=gemtag_transceive(gh,GEMTAG_CMD_PICC_WRITE,buf,17,buf,&len);
 
        return ret;
 }
@@ -361,17 +370,22 @@ int main(int argc, char **argv) {
        }
        printf("\n");
 
-       /* try to write some data
-       printf("write some data to the 5th sector:\n");
+       /* try to write some data */
+       printf("write some data to the sector 04:\n");
        for(i=0;i<16;i++) buf[i]=i;
        i=4;
+       ret=gemtag_auth_mifare_key(gh,key6,i);
+       printf("return = %d\n",ret);
+       if(ret) printf("auth failed!\n");
        ret=gemtag_write16(gh,i,buf);
+       if(ret) printf("write failed!\n");
+       printf("return = %d\n",ret);
+       ret=gemtag_read16(gh,i,buf);
+       if(ret) printf("read failed!\n");
        printf("return = %d\n",ret);
-       gemtag_read16(gh,i,buf);
        printf("%02x: ",i);
        hexdump(buf,16);
        printf("\n");
-       */
 
        gemtag_close(gh);