Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

REORG Refactor pen detection

  • Loading branch information...
commit a11739481261eb40bca07967ce5ad04ae5664e0c 1 parent 8b20ce5
@luispedro authored
Showing with 7 additions and 7 deletions.
  1. +5 −5 GUIFrame.cpp
  2. +2 −2 include/Smartpen.h
View
10 GUIFrame.cpp
@@ -352,10 +352,10 @@ uint16_t GUIFrame::refreshDeviceState() {
return 0x0000;
} else {
printf("detecting smartpen...");
- printf("smartpen idProduct: %s\n", dev->descriptor.idProduct);
- if (dev->descriptor.idProduct == LS_PULSE) {
+ printf("smartpen idProduct: %d\n", dev->descriptor.idProduct);
+ if (is_ls_pulse(dev->descriptor.idProduct)) {
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");
} else {
printf("Unknown LiveScribe device detected! Attempting to use this device anyways...\n");
@@ -375,10 +375,10 @@ void GUIFrame::doRefreshDeviceState() {
statusBar->SetStatusText(_("Unable to locate a compatible Smartpen device"), 1);
} else {
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);
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);
printf("LiveScribe Echo(TM) Smartpen Detected!\n");
} else {
View
4 include/Smartpen.h
@@ -28,8 +28,8 @@ along with LibreScribe. If not, see <http://www.gnu.org/licenses/>.
#include <usb.h>
#define LS_VENDOR_ID 0x1cfb //LiveScribe Vendor ID
-#define LS_PULSE 0x1020 //LiveScribe Pulse(TM) Smartpen
-#define LS_ECHO 0x1030 //LiveScribe Echo(TM) Smartpen
+inline bool is_ls_pulse(unsigned int c) { return c == 0x1020; } //LiveScribe Pulse(TM) Smartpen
+inline bool is_ls_echo(unsigned int c) { return c == 0x1030 || c == 0x1032; } //LiveScribe Echo(TM) Smartpen
static struct usb_device *findSmartpen() {
struct usb_bus *bus;
Please sign in to comment.
Something went wrong with that request. Please try again.