Skip to content

Commit

Permalink
REORG Refactor pen detection
Browse files Browse the repository at this point in the history
  • Loading branch information
luispedro committed Aug 6, 2011
1 parent 8b20ce5 commit a117394
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions GUIFrame.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -352,10 +352,10 @@ uint16_t GUIFrame::refreshDeviceState() {
return 0x0000; return 0x0000;
} else { } else {
printf("detecting smartpen..."); printf("detecting smartpen...");
printf("smartpen idProduct: %s\n", dev->descriptor.idProduct); printf("smartpen idProduct: %d\n", dev->descriptor.idProduct);
if (dev->descriptor.idProduct == LS_PULSE) { if (is_ls_pulse(dev->descriptor.idProduct)) {
printf("LiveScribe Pulse(TM) Smartpen Detected!\n"); printf("LiveScribe Pulse(TM) Smartpen Detected!\n");
} else if ((dev->descriptor.idProduct == LS_ECHO) || (dev->descriptor.idProduct == 0x1032)) { } else if (is_ls_echo(dev->descriptor.idProduct)) {
printf("LiveScribe Echo(TM) Smartpen Detected!\n"); printf("LiveScribe Echo(TM) Smartpen Detected!\n");
} else { } else {
printf("Unknown LiveScribe device detected! Attempting to use this device anyways...\n"); printf("Unknown LiveScribe device detected! Attempting to use this device anyways...\n");
Expand All @@ -375,10 +375,10 @@ void GUIFrame::doRefreshDeviceState() {
statusBar->SetStatusText(_("Unable to locate a compatible Smartpen device"), 1); statusBar->SetStatusText(_("Unable to locate a compatible Smartpen device"), 1);
} else { } else {
this->mainToolbar->EnableTool(idToolbarInfo,true); this->mainToolbar->EnableTool(idToolbarInfo,true);
if (dev->descriptor.idProduct == LS_PULSE) { if (is_ls_pulse(dev->descriptor.idProduct)) {
statusBar->SetStatusText(_("LiveScribe Pulse(TM) Smartpen Detected!"), 1); statusBar->SetStatusText(_("LiveScribe Pulse(TM) Smartpen Detected!"), 1);
printf("LiveScribe Pulse(TM) Smartpen Detected!\n"); printf("LiveScribe Pulse(TM) Smartpen Detected!\n");
} else if (dev->descriptor.idProduct == LS_ECHO) { } else if (is_ls_echo(dev->descriptor.idProduct)) {
statusBar->SetStatusText(_("LiveScribe Echo(TM) Smartpen Detected!"), 1); statusBar->SetStatusText(_("LiveScribe Echo(TM) Smartpen Detected!"), 1);
printf("LiveScribe Echo(TM) Smartpen Detected!\n"); printf("LiveScribe Echo(TM) Smartpen Detected!\n");
} else { } else {
Expand Down
4 changes: 2 additions & 2 deletions include/Smartpen.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ along with LibreScribe. If not, see <http://www.gnu.org/licenses/>.
#include <usb.h> #include <usb.h>


#define LS_VENDOR_ID 0x1cfb //LiveScribe Vendor ID #define LS_VENDOR_ID 0x1cfb //LiveScribe Vendor ID
#define LS_PULSE 0x1020 //LiveScribe Pulse(TM) Smartpen inline bool is_ls_pulse(unsigned int c) { return c == 0x1020; } //LiveScribe Pulse(TM) Smartpen
#define LS_ECHO 0x1030 //LiveScribe Echo(TM) Smartpen inline bool is_ls_echo(unsigned int c) { return c == 0x1030 || c == 0x1032; } //LiveScribe Echo(TM) Smartpen


static struct usb_device *findSmartpen() { static struct usb_device *findSmartpen() {
struct usb_bus *bus; struct usb_bus *bus;
Expand Down

0 comments on commit a117394

Please sign in to comment.