Monday, June 10, 2013

[ANE] Use AIR to get USB device ID

by http://www.anymeme.org

That's long Time ago I did ANE HelloWorld for VC++ but didn't had free time to share yet. Suddenly I have some project that will need something like USB hardlock which won't allow program running if USB not plugged in...Challenge Accepted!

AIR with ANE to get USB unique ID which some interval check is a way to go for this case so here we go!

Resource

  1. ANEhttp://help.adobe.com/en_US/air/extensions/WS460ee381960520ad-866f9c112aa6e1ad46-8000.html
  2. Code : actually c# is look a lot easier but c++ is close to objective-c enough so i give it a try here is code i use https://gist.github.com/katopz/5734124
  3. Editor : Microsoft Visual Studio Express 2012 http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-for-windows-8#product-express-windows
  4. Knowledge Base : some c++, some as3, some googling for .h,.lib and TCHAR fantasy conversion

Result

Tadaaa, USB\VID_xxxx&PID_yyyy\zzzz seem legit and unique enough for me. :D

Download

as3 example, ane build.bat, vc++ bla bla bla all here! https://github.com/katopz/ane-usb-util just Don't forget to feed my cat

[UPDATE ] Just realize that I already blog about USB ANE here while ago...so I just wasting my time here LOL, lucky me I love to code so it didn't hurt that much ;)

Happy coding! ;)

No comments: