Skip to content

Instantly share code, notes, and snippets.

@paralleltree
Last active March 31, 2017 00:33
Show Gist options
  • Save paralleltree/398fa48a035d3713d912c06b068ea296 to your computer and use it in GitHub Desktop.
Save paralleltree/398fa48a035d3713d912c06b068ea296 to your computer and use it in GitHub Desktop.
Reading IDm from a FeliCa card with libpafe-ruby
require 'pasori'
begin
Pasori.open do |p|
warn 'Waiting for a card...'
begin
p.felica_polling do |f|
warn 'Reading...'
puts sprintf("%016X", f.idm.unpack('Q>').first)
end
break
rescue PasoriError
sleep 1
end while true
end
rescue Interrupt
exit 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment