From 744e2ca356439a374246376b5f9553871fdf753b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sergi=20Hern=C3=A0ndez=20Juan?= <shernand@iri.upc.edu>
Date: Tue, 20 Nov 2012 10:28:45 +0000
Subject: [PATCH] Changed the project name to avoid problems in the ubuntu
 package creation. Solved a minor bug.

---
 trunk/CMakeLists.txt              | 2 +-
 trunk/src/examples/CMakeLists.txt | 4 ----
 trunk/src/usb_i2c.cpp             | 4 ++--
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/trunk/CMakeLists.txt b/trunk/CMakeLists.txt
index 1aede89..0dafa28 100644
--- a/trunk/CMakeLists.txt
+++ b/trunk/CMakeLists.txt
@@ -8,7 +8,7 @@ if(COMMAND cmake_policy)
 endif(COMMAND cmake_policy)
 
 # The project name and the type of project
-PROJECT(library_name)
+PROJECT(usb-i2c-adapter)
 
 SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
 SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
diff --git a/trunk/src/examples/CMakeLists.txt b/trunk/src/examples/CMakeLists.txt
index f41d1fd..8e52e36 100644
--- a/trunk/src/examples/CMakeLists.txt
+++ b/trunk/src/examples/CMakeLists.txt
@@ -4,8 +4,4 @@ ADD_EXECUTABLE(test_usb_i2c test_usb_i2c.cpp)
 # edit the following line to add the necessary libraries
 TARGET_LINK_LIBRARIES(test_usb_i2c usb_i2c_adapter ${iriutils_LIBRARY} ${comm_LIBRARY})
 
-# edit the following line to add the source code for the example and the name of the executable
-ADD_EXECUTABLE(test_camera test_camera.cpp)
 
-# edit the following line to add the necessary libraries
-TARGET_LINK_LIBRARIES(test_camera usb_i2c_adapter ${iriutils_LIBRARY} ${comm_LIBRARY})
diff --git a/trunk/src/usb_i2c.cpp b/trunk/src/usb_i2c.cpp
index 0340dea..8eef91a 100644
--- a/trunk/src/usb_i2c.cpp
+++ b/trunk/src/usb_i2c.cpp
@@ -300,7 +300,7 @@ int CUSBI2C::write(unsigned char dev_id, unsigned char *data, int len)
   unsigned char status;
   int written=0,read=0;
 
-  if(len>1)
+  if(len<1)
   {
     /* handle exceptions */
     throw CUSBI2CException(_HERE_,"At least one byte must be send in a write operation");
@@ -339,7 +339,7 @@ int CUSBI2C::write(unsigned char dev_id, unsigned char *data, int len)
       }
     }
   }  
-  return written;
+  return len;
 }
 
 int CUSBI2C::read(unsigned char dev_id, unsigned char *data, int len)
-- 
GitLab