Skip to content

leh/ruby-mirror

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Identify the device

After connecting your mir:ror you can find the device via dmesg:

$ dmesg
...
hiddev96hidraw3: USB HID v1.00 Device [Violet Mirror] on usb-0000:00:0b.1-1.3

this points to

$ ls /dev/hidraw*

crw-rw---- 1 root root 252, 0 2009-02-15 22:02 /dev/hidraw0
crw-rw---- 1 root root 252, 1 2009-02-15 22:02 /dev/hidraw1
crw-rw---- 1 root root 252, 2 2009-02-15 22:02 /dev/hidraw2
crw-rw---- 1 root root 252, 3 2009-03-25 22:14 /dev/hidraw3 <----

“Adjust” the permission

To access the interface you have to make it world-readable:

$ sudo chmod o+r /dev/hidraw3
$ ls /dev/hidraw*

crw-rw---- 1 root root 252, 0 2009-02-15 22:02 /dev/hidraw0
crw-rw---- 1 root root 252, 1 2009-02-15 22:02 /dev/hidraw1
crw-rw---- 1 root root 252, 2 2009-02-15 22:02 /dev/hidraw2
crw-rw-r-- 1 root root 252, 3 2009-03-25 22:14 /dev/hidraw3 <----

You’ll have to repeat this each time you plug the mir:ror in.

Adjust the path

Change /dev/hidraw3 to your device in bin/ruby-mirror.rb

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.

About

A ruby library for reading rfid tags with violets mir:ror

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages