ozsuakin
Posts: 5
Joined: Sat Jun 27, 2015 2:26 pm

trying to get tagid from usb rfid reader

Sat Jun 27, 2015 2:33 pm

Hi, everyone

i am trying to get tag id from usb rfid readers. But the problem is two of them has same vendor id and device id.

I am getting tagid from one of them by using pyusb.

is it possible to change vendor or device id? or any other solution.
Image
Best regards

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: trying to get tagid from usb rfid reader

Sat Jun 27, 2015 3:40 pm

I'm not sure how to use the Device ID's but they're different for each device, according to the image you posted one's 7 and the other's 8.

Dave.
Apple say... Monkey do !!

ozsuakin
Posts: 5
Joined: Sat Jun 27, 2015 2:26 pm

Re: trying to get tagid from usb rfid reader

Sat Jun 27, 2015 3:55 pm

No, not different, also on windows 7, same vendor and device id appears. Do u think can I seperate the devices by their USB name?

Bus 001 Device 009: ID 08ff:0009 AuthenTec, Inc.
Bus 001 Device 007: ID 08ff:0009 AuthenTec, Inc.

User avatar
DougieLawson
Posts: 39301
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: trying to get tagid from usb rfid reader

Sat Jun 27, 2015 4:09 pm

Take a look at the output from
lsusb -s 001:007 -v
lsusb -s 001:009 -v

Do you get a unique "iSerial" number for each reader?
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

ozsuakin
Posts: 5
Joined: Sat Jun 27, 2015 2:26 pm

Re: trying to get tagid from usb rfid reader

Sat Jun 27, 2015 4:12 pm

Both are :
iProduct 2
iSerial 3

I think i have to find another way, except pyusb

User avatar
DougieLawson
Posts: 39301
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: trying to get tagid from usb rfid reader

Sat Jun 27, 2015 4:24 pm

Is there anything in the USB device profile that uniquely identifies each device (apart from the bus ID which can change on the next reboot).
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

ozsuakin
Posts: 5
Joined: Sat Jun 27, 2015 2:26 pm

Re: trying to get tagid from usb rfid reader

Sat Jun 27, 2015 4:31 pm

Image this is the device, every specifications are same. we have to handle it in python script

ozsuakin
Posts: 5
Joined: Sat Jun 27, 2015 2:26 pm

Re: trying to get tagid from usb rfid reader

Fri Jul 03, 2015 8:41 am

DougieLawson wrote:Is there anything in the USB device profile that uniquely identifies each device (apart from the bus ID which can change on the next reboot).
ok. I found the solution.

we can resolve by using library evdev library of python.
serial and urllib2 is extra :)

Code: Select all

from evdev import InputDevice, list_devices, categorize, ecodes
from select import select
import urllib2
import serial

port = serial.Serial("/dev/ttyUSB0", baudrate=9600)

devices= map(InputDevice,('/dev/input/event0', '/dev/input/event1'))
devices = {dev.fd: dev for dev in devices}

numarag = ""

while True:
    r, w, x = select(devices,[],[])
    for fd in r:

        for event in devices[fd].read():
            if event.type == ecodes.EV_KEY:
                keybrd = categorize(event)
                if keybrd.keystate == keybrd.key_down:
                    g = keybrd.keycode
                    numg = g.split("_")
                    rakamg = numg[1]
                    if rakamg == "ENTER":
                        if str(r) == "[5]":
                            kartg = "G-"+numarag+"#"
                            print kartg
                            response = urllib2.urlopen('http://localhost/adminturnike/turnike.php?kart='+kartg+'')
                            html = response.read()
                            print html
             if html=='a' or html=='1':
                port.write(html)
                            kartg = ""
             numarag = ""
                        elif str(r) == "[4]":
                            kartc ="C-"+numarag+"#"
                            print kartc
                            response = urllib2.urlopen('http://localhost/adminturnike/turnike.php?kart='+kartc+'')
                            html = response.read()
                            print html
             if html=='a' or html=='1':
                port.write(html)
                            kartc = ""
             numarag = ""
                    else:
                        numarag = numarag + rakamg.strip()

Return to “Python”