It's been done with an Arduino, just not with a Pentax.
See this article here However, the only difference is the command codes (which Tomaszcos has evidently deciphered already), so, setting this up for a Pentax DSLR shouldn't be too hard. The only inconvenience I can see is that, due to the arduino's limited memory capacity, it may not be possible to make ir support all pentax cameras with the same code. But maybe it would. In any case, I'd be willing to give this a shot if I could theoretically figure out how to code it. I already have the Arduino, the required USB host shield sells for $24.95.
With my Pentax *ist D I had managed to use the Arduino in order to set off the shutter when a laser beam was interrupted. Also, since Remote Assistant didn't work on OS X 10.4, I had managed to "Pseudo Tether" my istD with the arduino connected via USB to my Macbook and the *ist D's 2.5mm shutter control wired to the arduino. I would have the camera take a picture when my Mac's iSight camera detected movement (awesome for getting shots of birds in flight). With the device described in the link above something very similar could be done for a pentax k-x or any other without a 2.5mm jack, but even better: without the need of a computer connected to the camera.