Пример #1
0
def rfid_reader_proc(side):
    try:
        # find RFID USB devices
        devices = tuple(
            usb.core.find(find_all=True, idVendor=0x08ff, idProduct=0x0009))
        if (len(devices) != 2):
            print "Both RFID Readers are not found!"
            raise RuntimeError
        if (side == "home"):
            device = devices[0] if (
                devices[0].address < devices[1].address) else devices[1]
        else:
            device = devices[1] if (
                devices[0].address < devices[1].address) else devices[0]

        reader = RFIDReader(0x08ff,
                            0x0009,
                            84,
                            16,
                            should_reset=False,
                            debug=False,
                            device=device)
        reader.initialize()

        while True:
            id = reader.read().strip()
            print(side + " " + id)
            r = requests.post(SERVER_URL + "/events/addplayer/" + side,
                              params={'id': id})
            print r.text

    except KeyboardInterrupt:
        pass
Пример #2
0
def main():
	card_id = "1851655304"
	reader.initialize()
	p = subprocess.Popen("exec i3lock -n ; killall rfid_login.py", stdout=subprocess.PIPE, shell=True)
	while True:
		RFID_input = reader.read().strip()
		if RFID_input == card_id:
			print "Access Granted" 
			p.kill()
			print "Read uuid from RFID reader:{0}".format(RFID_input)
                        sys.exit()
		else:
			print "Access Denied"
			print "Read uuid from RFID reader:{0}".format(RFID_input)
Пример #3
0
def rfid_reader_proc(side):
    try:
        # find RFID USB devices
        devices = tuple(usb.core.find(find_all=True, idVendor=0x08ff, idProduct=0x0009))
        if (len(devices) != 2):
            print "Both RFID Readers are not found!"
            raise RuntimeError
        if (side == "home"):
            device = devices[0] if (devices[0].address < devices[1].address) else devices[1]
        else:
            device = devices[1] if (devices[0].address < devices[1].address) else devices[0]
    
        reader = RFIDReader(0x08ff, 0x0009, 84, 16, should_reset=False, debug=False, device=device)
        reader.initialize()

        while True:
            id = reader.read().strip()
            print(side + " " + id)
            r = requests.post(SERVER_URL + "/events/addplayer/" + side, params={'id' :id} )
            print r.text
            
    except KeyboardInterrupt:
        pass
from keyboard_alike import reader


class RFIDReader(reader.Reader):
    """
    This class supports common black RFID Readers for 125 kHz read only tokens
    http://www.dx.com/p/intelligent-id-card-usb-reader-174455
    """
    pass


if __name__ == "__main__":
    reader = RFIDReader(0x08ff, 0x0009, 84, 16, should_reset=False)
    reader.initialize()
    print(reader.read().strip())
    reader.disconnect()
Пример #5
0
def read_rfid():
    reader = RFIDReader(0x08ff, 0x0009, 84, 16, should_reset=False)
    reader.initialize()
    rfid_code = reader.read().strip()
    reader.disconnect()
    return rfid_code
from keyboard_alike import reader


class RFIDReader(reader.Reader):
    """
    This class supports common black RFID Readers for 125 kHz read only tokens
    http://www.dx.com/p/intelligent-id-card-usb-reader-174455
    """

    pass


if __name__ == "__main__":
    reader = RFIDReader(0x08FF, 0x0009, 84, 16, should_reset=False)
    reader.initialize()
    print(reader.read().strip())
    reader.disconnect()