A ruby library for reading rfid tags with violets mir:ror
Ruby
Switch branches/tags
Nothing to show
Pull request Compare This branch is 3 commits ahead of leh:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
examples
lib
.gitignore
COPYING
README.rdoc

README.rdoc

ruby-mirror

This library tries to provide an open source interface to the rfid reader mir:ror by violet. This is only tested on linux. Maybe it works on other Unixes (FreeBSD, OSX, etc.) too.

Protocol

Sample input:

Mifare-type rfid (used in some cafeteria / library cards)
02 01 00 00 04 72 9c 0b 90

nano:ztag
02 02 00 00 08 d0 02 1a 03 52 d0 2a af

Protocol:

               ------- payload ------
               |  |  |  |  |  |  |  |

            -- payload size
            |
02 02 00 00 08 d0 02 1a 03 52 d0 2a af
^
-- opening flag

   ^
   -- direction (01 for arriving at the reader / 02 for leaving the reader)

      ^  ^
      ------ padding or additional payload size information

Using the library

This is rather a rough scretch than a working interface.

To use this, you have to

Access to the device

In order to be able to access the mir:ror ruby-mirror needs read access to the device file. ruby-mirror will automatically try to detect the device and set the necessary permissions. In order to do so it needs root privileges. ruby-mirror will try to obtain those privileges by first trying sudo and if that fails su.

The script running with root privileges (detect-mirror) is completely seperated from all other ruby-mirror code. After successful detection all ruby-mirror code runs with normal user privileges.

Run the sample

$ ruby bin/ruby_mirror.rb examples/bunny.mir

oneiros' green bunny is in the house.
oneiros' green bunny has left the building.
hey d0021a053b4d20c3 stranger, never seen you before

Misc

Mir:ror ID

$ sudo lsusb -d 1da8:1301 -v

Bus 001 Device 010: ID 1da8:1301  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x1da8 
  idProduct          0x1301 
  bcdDevice            1.00
  iManufacturer           4 Violet
  iProduct               18 Mirror
  iSerial                32 4310FFFF <----
  bNumConfigurations      1

which corresponds to the violets mir:ror id FFFF0134

Help

If you can provide code or information regarding the mir:ror or the ztamps please contact me.

License

See COPYING for legal information. It's an MIT license, which lets you do anything you want with this.