RFID Toys Homepage
Holy crap, check out the Dangerous Things store!
Forum Home Forum Home > Projects and such > HOW-TOs and other projects
  New Posts New Posts RSS Feed - How to: Parallax usb RFID on terminal for Mac
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to: Parallax usb RFID on terminal for Mac

 Post Reply Post Reply
Author
Message
wolfdog1987 View Drop Down
Groupie
Groupie


Joined: 24 July 2009
Location: United States
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote wolfdog1987 Quote  Post ReplyReply Direct Link To This Post Topic: How to: Parallax usb RFID on terminal for Mac
    Posted: 31 May 2012 at 12:18pm
Well i am now the owner of a Mac, and it was irritating for me to switch to windows every time i wanted to use my parallax reader to test my tags for read range, etc. So i spent about an hour trying to figure out how to make it work in the terminal of OSX. All this does is connect to the reader via terminal and spit out tag IDs when it reads them, it really isnt of much use besides testing read range or telling you tag IDs.

First thing i did was go to FTDI's website and download their USB serial drivers. For this i downloaded version 2.2.17 x86 and installed it as per the installation guide. Downloaded here.

Download the file, click on the one specific to your version of OSX, which can be found by clicking the apple in the upper left of your screen, and clicking "about this mac".

Reboot the machine, plug in your reader.

I then had to open up the terminal emulator program, found at Go>utilities>terminal.

From here you're going to need the location and ID of the device itself. For this i typed in:

ls /dev/tty.*
(That's an L, otherwise type it exactly as i did. You should be able to copy/paste it)

From there it should spit out something like this:


Where "/dev/tty.usbserial-A7006cKo" is the part you're looking for.
After that you input this into the terminal to connect to the device:

screen /dev/tty.usbserial-A7006cKo 2400

Replace my device number with yours, and "2400" would be the connection speed, should be 2400 for all of the usb parallax rfid readers.

The light on your reader should turn red, and give you a blank screen. Running a tag over the reader should output the tag ID.

To exit this screen, press control-a then K. It will ask if you are sure you want to kill this process, you push Y for yes.

So far i am still unable to do much more since i am not a programmer, however i do know some people that are learning programming, and i may try to con one of them into attempting to help with some of this stuff. Hopefully someone can find this useful, enjoy.



Back to Top
amal View Drop Down
Admin Group
Admin Group
Avatar

Joined: 22 November 2005
Location: United States
Status: Offline
Points: 2061
Post Options Post Options   Thanks (0) Thanks(0)   Quote amal Quote  Post ReplyReply Direct Link To This Post Posted: 04 June 2012 at 8:53am
Hey Wolfdog1987, 

That's great. Thanks for sharing! There is so little OS X coverage on this forum, it's good to see a post that shares how it's done! I did have a contact at one time that was able to create a Mac logon program that let him log in using his RFID tag, but he never did post the code :(
Amal ;)
www.amal.net
Back to Top
socialdefect View Drop Down
Newbie
Newbie


Joined: 04 February 2013
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote socialdefect Quote  Post ReplyReply Direct Link To This Post Posted: 04 February 2013 at 2:17am
Thanks for sharing! I wrapped the above in a .app to save some time. The .app is basically just a wizard which asks you to un/plug your device and uses temp files which it checks for a difference to find the connected RFID reader's device name. Then it opens the screen command in a terminal window.

The code is quite static so it has it's limits. Naturally the app is open source (BSD  License) so use and fork as you like...

Download iRFIDreader (Universal Binary PPC/Intel) and Download md5 and sha1 checksums (If you like to check your download for errors.)

I've not found many info on how to read from the device in OSX and use this info in shell scripts. In Linux I use stty to start a connection and dd to read it's data but for some reason I can't get this to work on OSX (10.5.8 PPC on a G5). I would have guessed this would work exactly the same???...

How I use RFID in shell scripts in Linux:
#!/bin/bash

DEVICE="/dev/tty.usbserial-A7006gOG"

stty -f $DEVICE cs8 -ixon raw speed 2400

READID=`dd if=$DEVICE bs=1 count=10`

while true ; do
if [ $READID = 'ENTER_TAG_ID' ] ; then
       <------command------>
elif [ $READID = 'ENTER_TAG_ID' ] ; then
       <------command------>
fi
done

exit $?


Some other way I found to read it's data is by using:

READID=$(od -A n -c -j 1 -N 10 $DEVICE | sed 's/   //g')


Update:
It seems I was just being plain stupid...... The above examples for Linux DO work on OSX if you only remember to add your user to the tty usergroup Big smile
Normally joining the system gangs is one of the first things I do on a fresh install but this time I seem to have forgotten to do that..... But well.... Another Problem Solved......

For those that have never heard of UNIX user groups; This is one of the main reasons UNIX is as secure as it is. All users and some programs/types of programs have their own user group and all files on the system are owned by both a user and a user group. For example you need to be in the video group to be able to use the webcam (on a strict system) and need to be in the proxy group to connect to a local proxy server. More info on the subject can be found on a.o. http://tldp.org.

* Joining a group on OSX:
My OSXLeopard PPC does not include the modern tools used on Linux/BSD (useradd & gpasswd) but editing the config file is super easy, JUST DON'T MAKE TYPO's for advanced system recovery is a bit harder to learn!!!

The UNIX core of OSX is well hidden in the finder so you'll need to use the terminal program. Just type: Terminal in Finder and it'll show-up. Just copy & Paste the command below to create a backup of the current config and then open the group config in your default GUI texteditor:

cd /etc && sudo cp group group.backup && sudo open group


Replace open in the final part for your favorite text editor if you rather use nano or vi.

Example (Before):
tty:*:4:root
operator:*:5:root
mail:*:6:


Example (After):
tty:*:4:root,yourusername
operator:*:5:root
mail:*:6:yourusername



Edited by socialdefect - 05 February 2013 at 3:12am
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.219 seconds.