Significant LibreScribe Progress Made

As you may have noticed, I took a break from working on LibreScribe for a while, and the project looked as though it was abandoned. Well, it isn’t, and I’ve got tons of good news! Since the last time I wrote an update about LibreScribe, in late May, I made several incredibly significant changes. Some of these may not seem that exciting, but they are absolutely crucial in order to further develop the program. Some of these new features (such as retrieving and changing the name of the device) didn’t exist in libSmartpen at all, so implementing them required me to capture packets sent over USB and do a bit of reverse engineering. At first, I used the trial version of USBTrace, but I quickly realized that it wasn’t the tool for the job when I got notifications that I used more than my 256K data limit just by opening LiveScribe Desktop. To make it even less appealing, it costs $195 USD for a single license! That’s ridiculous! So of course, I did a bit of searching, and I found busdog, which does the same job (although using unsigned filter drivers that require modifying windows settings and rebooting several times) for free! Although getting it setup was significantly more frustrating than getting USBTrace working, it was well worth not paying $195, and it does everything I need it to, albeit without as nice of an interface. Anyways, here’s a list of significant changes I made:

  • LibreScribe no longer crashes when retrieving the list of applications installed on the device. This was incredibly frustrating when I was trying to develop it. It also filters out the LiveScribe Connect and System files, so that they are not listed if they are present on the device.
  • Instead of displaying a hard-coded list of notebooks, LibreScribe now retrieves the names of all of the notebooks actually in use on the device.
  • When a device is not present on the system, or LibreScribe can’t find it, the page tree now shows a “No Smartpen Detected” item, along with an brand new icon that indicates that no device is connected instead of the regular pen icon.
  • I added context menu event handlers to the page tree, so now when you right click or press the menu button, LibreScribe can display a menu of options relevant to the item you clicked. More work on this still needs to be done, but if you click the root element (the smartpen itself, or the placeholder when one isn’t connected), you will now see a new menu allowing you to rename the device, refresh the connection, or display information about the device.
  • When the device is unplugged or plugged in, the page tree and the applications/audio lists will now automatically refresh themselves.
  • LibreScribe now retrieves the name of the smartpen from the device, rather than defaulting to “My LiveScribe Smartpen”. It can also set the name of the pen, but this feature is still a little bit buggy (it won’t brick your device, so it’s safe to test). Interesting discovery: In the LiveScribe desktop software, you can set the name of the pen to anything up to 50 characters. This does not mean that the device doesn’t allow more than that, it’s just a ‘soft’ limit in the LiveScribe desktop software. There probably is an actual limit, but I was able to set the device name to almost a paragraph of text, including every symbol you can type on a standard US keyboard, and retrieving it from the pen worked perfectly. The pen stored the entire thing, and returned it when I checked the name, although it did not display the entire string when I turned the device on, just the first part of it. The string of text I tested was “~`!@#$%^&*()-_+={}[]:;”‘<>?/,.\ Testing the maximum name length for a LiveScribe Smartpen… I wonder if I could fit a paragraph in here…? You have got to be kidding me… I typed this much and it STILL works? That’s incredible. There’s virtually no limit to how long the smartpen’s name is. I can’t believe I can set and receive values this long! I’m speechless…“. Needless to say, you can store almost anything in the name of the Smartpen. I wonder how the LiveScribe desktop software would react if it tried to retrieve this string.
  • I added a dialog box to rename the device, as well as another dialog box to confirm the new name.
  • LiveScribe no longer crashes when removing or connecting a smartpen while the program is running.
  • I merged in the inline functions written by Luis Pedro Coelho on his fork of LibreScribe, which are a better implementation of device type checking than I had
  • Tons of new debugging output was added. You can see this output on the console. This makes figuring out what went wrong in a crash so much easier.

Remember, LibreScribe is still alpha quality and should not be used in a production environment. If you have any issues or suggestions, feel free to file a bug report. Or, if you’re skilled enough, I’d appreciate it if you fixed the bug yourself, and submitted a patch. Ah, the benefits of open source coding! This is only just the beginning. Expect tons of new enhancements and bug fixes over the next several months.

LibreScribe Progress Update

Since my last post, I have made a lot of progress with LibreScribe. Just a few commits ago, LibreScribe gained the ability to retrieve a list of installed applications on the device, and add them to the list in the applications tab. I also fixed several other significant issues, including:

  • When the smartpen is connected/disconnected, the application no longer crashes, and the status is automatically refreshed
  • Device storage usage is now displayed in MiB instead of in bytes. This makes it a lot less confusing how much space is remaining on your smartpen.
  • A bug, where the Echo Smartpen was detected as an “unknown LiveScribe Smartpen” in certain cases was fixed.
  • All absolute paths have been removed from the project. All resources are now referenced using relative paths.
  • wxFormBuilder has been replaced with wxSmith. The entire user interface has been recreated from scratch (although it’s very similar to the old interface, intentionally)
  • Many C++ source and header files are no longer necessary, so they have been removed, and merged into other files. This makes the codebase a lot more maintainable.
  • Duplicate udev events (such as multiple add events of the same device) are ignored now. Previously, we ended up refreshing the device information up to four times in a row because of duplicate events. This significantly reduces the delay between plugging in a device and seeing a response on the screen.

There are still tons of issues that still need to be fixed before LibreScribe becomes usable in a production environment, but I’ve been steadily making progress, and I hope to have something useful out soon.

Major Bug Fix in LibreScribe

A lot of work on the LibreScribe project has been accomplished since I first wrote about it. Just today, I fixed a major regression which was preventing the device information dialog from being displayed. In addition to that, I now have more work done on the interface, so that when the windows is resized, most of the elements will scale properly to fit the new size. Another major change I made was setting up the layout of the “Audio” and “Applications” tabs, so that there are now lists, with data split into columns. These changes mark a significant improvement in the look and feel of LibreScribe, but it’s only the beginning. Expect a large number of major changes in the not-too-distant future.

LibreScribe, My Latest (and Most Challenging) Project

Image representing Livescribe  as depicted in ...
Image via CrunchBase

Over the past few days, I’ve been working on attempting to code an open source Smartpen Manager for Livescribe devices, based off of the work done in Steven Walter’s libsmartpen project, which hasn’t been updated for months. The project is called “LibreScribe”, and the source code is already on github right now. The code will be written primarily in C++, with limited functionality (such as threads) from the upcoming C++0x standard, and it will use wxWidgets for the graphical user interface, which will be built using wxFormBuilder, attempting to follow the Tango guidelines as close as possible. So far, I have only scratched the surface of all the coding that will be necessary, so it would be great if some of the coders reading this would step up to the plate and help out. Even small things, such as documenting functions, adding comments, ensuring source code style consistency, and making it easier to maintain the source code are incredibly important. Right now, there’s still tons of work to do. So much, in fact, that it’s actually easier to list what’s done than what’s left to do. Right now, I’m focusing on fixing bugs and writing functions to check the status of the connected Smartpen. To be more specific, some of the most important bugs at the moment include:

  • When the user plugs in or unplugs the device, the background thread updates the status of the device behind the scenes, but nothing is reflected in the user interface.
  • Clicking the “Device Information” button twice without closing the program results in a segmentation fault.
  • Currently, only LiveScribe Pulse devices are detected. LiveScribe Echo devices should work, but I can’t check the USB product ID property of them without physical access to one.
  • The program is not currently capable of retrieving the name of the Smartpen. More OBEX analysis is necessary to determine how the official desktop client retrieves the name of the Smartpen.

Once I have all of these bugs fixed, I will begin working on adding more of the code from libsmartpen into the project, fixing up existing code, and writing new code. This is probably one of the toughest coding projects I’ve started, but I enjoy the challenge, and I hope to create something genuinely useful to the open source community, improve my own coding ability, and learn new things. I frequently push changes to github, as long as I don’t notice any significant regressions, so you can track my progress in almost real-time. At the moment, the user interface is far from being finished (link is a screenshot), but it’s not too bad. Also, feel free to fork the code base, and make improvements.