Thursday, 12 September 2013

Project update

Here's a brief list of things that I've done recently:

InputStick background service:
  • fixed some issues that caused the service to crash.
  • service now makes several attempts to establish a Bluetooth connection.
  • added support for resuming session.

DeviceManager (app): 
  • verifying device before adding to database.
  • notifications in status bar.
  • sub-menu instead of context menu in DeviceList.
  • application asks user to enable Bluetooth only when this is necessary
  • added "Test" functionality, which configures InputStick as a USB keyboard, logs communication and allows to send test report back to me (via email).

Main activity

No more context menu.

  • added support for resuming session. 
  • added request callbacks.

So now each subclass of USBDevice can override following methods:

public void resetState();
Resets state of USBDevice, called after device state has been set to "Configured" by USB host, or when previous session has been resumed.

public void incomingData(int endp, byte[] data);
Called when new report is received form USB host.

public void incomingResumeData(int endp, byte[] data);
Called when session is resumed. Sends all reports stored in buffer for given endpoint. This allows to get most recent state of the device, which could have changed when application was not connected to InputStick However, each time there is no more free space in buffer, oldest reports are removed. Is this a problem? Well, that depends on a particular USB device. In case of USB keyboard, we are interested only in most recent state of Num/Caps/Scroll lock, so we don't care about previous reports.

public void incomingRequest(int requestNo, DeviceInfo info);
Called when host sends USB request. requestNo indicates which request has been received (this depends on order in which requests has been added), info allows to get data from setup packet (bmRequestType, bRequest, wValue, wIndex, wLength and some additional info).

public void incomingResumeRequest(int requestNo, DeviceInfo info);
This works similar to  incomingResumeData. And again, in case of USB mouse we are interested only in most recent value of report protocol set by USB host. In case of generic USB keyboard, report and boot protocols are exactly the same.


I thing about using slightly different model of enclosure. This one has a little bit more space inside, what will allow to improve PCB design (easier to assemble, better access to programmer/debugger pins). Also, it is made entirely from plastic, so InputStick weights 50% less than before. At this moment I'm almost done with redesigning PCB layout, so new PCBs should arrive next week.

No comments:

Post a Comment