« Alive | Main | ChiPy, March 2007 »

PSIG 101 | DDHidLib

Saturday, February 3, 2007

(What is PSIG? | PSIG 101 announcement)

I'm going to start taking notes at these programmer meetings I attend; mostly for my own benefit, but also because it would be a terrible shame for all of this to go unrecorded :).

Books, advice, ideas

Programming Special Interest Group
Presentation: DDHidLib

Dave began with a quick pictorial history of human interface devices. The hilarious thing about this group is that people actually remember the punch card reader and the teletype machine; someone even knew which model of teletype it was o___O.

I was especially interested in the video on Multi-Touch Interaction.

On to the main topic at hand: USB HID specifications include the HID device class (specifies how data should be extracted) and the HID usage tables (defines constants to be interpreted by the app). The specs can be downloaded here.

Apple's I/O kit has support for HID: IOHIDLib.

One of Apple's developer tools, IORegistryExplorer, provides a database of all devices on your system.

Accessing devices:

  1. Find the object that represents the device in the I/O registry
  2. Create device interface
  3. Open connection to device
  4. Communicate with device using functions provided by HID manager

Components of a device (every button, etc.) are called elements. Each element has unique number called a cookie, used to get status for the element. Cookies are static across sessions.

Queues for asynchronous notification:

  1. Create queue
  2. Add element cookies to queue
  3. Add queue to run loop
  4. Start queue

At this point, Dave gives us a detailed demo on IOHIDLib, scaring us with loads and loads of hard-to-understand code (scared me, anyway).

Then he whips out DDHidLib, his brilliant Obj-C wrapper around IOHIDLib. Why an Obj-C wrapper? Because of easier resource management, modern error handling, KVC/KVO (cocoa binding), and it makes common tasks easier. DDHidLib includes these classes: DDHidQueue and DDHidDevice<|---DDHidMouse

He also provides two very interesting utilities: HID Device Browser and HID Device Test. The device browser has this Event Watcher feature which we discovered can log keystrokes even while you're off typing in your OS X account password.

Dave hooked up various HIDs during his demo, like a Logitech Precision Gamepad and an N64 controller. He also passed around a variety of ancient game controllers -- you can get these things from Happ Controls. He concluded by playing the Atari 2600 game, Adventure, up on the big screen. All I can say is... wow :). We then discussed how somebody needs to make a repository for all these useful Cocoa tools, because Sourceforge doesn't accept everything.

1:09 PM

Comments

Bullets to bullets ^^.
---------------

-"Diallogging: two people doing the dialup-dance."

-"He held down Ctrl and Alt, and then began his arduous search for the Delete key."

-"Well, I was walkin' down the street, and... well... the rest is history."

-"I loved my father, you know--loved him as if he were my own son!"

-"He shook the dirty dishwasher off his hands like a master samurai cleaning his sword."

-"He'd never nodded on before, but then again, that was the first time he'd ever gone to sleep with the Sorceror's Apprentice pleonasting in his earbuds."

---------------

"So, you're kinda like a 'Jack of all trades, master of none?'"
"No! I was thinking more like... modern renaissance man."

---------------

"Oh, Biology! What do you do in Biology?" She seemed genuinely interested, but Edwin hated this question. He sighed quietly.

"I'm... I specialize in lichen," he mumbled, and was more than a little startled when she suddenly grabbed him by the shoulders.

"Really! Really!? I--I knew it! Werewolves do exist!" she exclaimed, eyes sparkling.

She looked so happy, really, that there was nothing he could but nod blankly.

------------------------

Posted by Weien at February 6, 2007 11:13 AM

The areas around her eyes were shallow, red wounds, birthed from the previous night she had, incidentally, spent in tears.

"Michael... why? I thought..." Eileen whimpered, wanting to reach out and touch the man she'd loved for so long, but afraid to, lest... lest she'd find out that he wasn't who she thought he was, after all. And all at once, she slipped her question out: "Why were you at that sushi place with Rebekka?"

Michael, with his eyes also puffy, turned to her slowly, and then he did dare touch her on the shoulder, his hand a lost bird alighting on the only live thing in a sea of dusty land. "Eileen," he croaked, and then seemed to give up the fight, forever unable to explain. The wind figure-eighted around the two standing mourners briefly, then gave away to Michael's voice, loud with desperation:

"Species diversity, Eileen! I didn't have a choice--none of us do, anymore! Do you think I wanted--"

Eileen switched off the hologram and turned to the calendar with angry satisfaction. Wiping a last, rogue tear away, she stared at the date, forty years after this had all happened: March 6, 2067. And from there, she tossed the disk into her desk incinerator and finally, finally... forgot about him.

Posted by Ruddy Lad at February 6, 2007 9:09 PM

Hey - thanks for taking notes at the most recent PSIG meeting! We have CocoaHeads meetings out here in Cupertino (I'm the Apple room-getter-person for the Silicon Valley group) but I kind of miss the folks back in the burbs. And thanks in particular for pointing out Dave's HID wrappers - they'll make it a lot easier to mess around with random interesting side projects with random input devices.

Posted by Chris Hanson at February 18, 2007 1:20 PM

"Sometimes, when it's late, and I'm at the piano, all of a sudden I see the black keys as sorts of... vampires, and relating them to the reciprocals of prime numbers, and..."

He sighed.

"By that point I usually figure it's just time for bed."

Posted by Weien at February 22, 2007 2:27 AM