Support MAC OS X 10.7,10.8 accepted/tizen/ivi accepted/tizen_ivi_panda tizen_ivi_panda accepted/tizen/20131029.080332 accepted/tizen/20131029.175713 accepted/tizen/20131112.015138 accepted/tizen/ivi/panda/20140403.000127 submit/tizen/20131029.071705 submit/tizen_ivi_panda/20140403.000543
authorjaehoon.you <jaehoon.you@samsung.com>
Fri, 11 Oct 2013 09:07:57 +0000 (18:07 +0900)
committerjaehoon.you <jaehoon.you@samsung.com>
Fri, 11 Oct 2013 09:07:57 +0000 (18:07 +0900)
On OS X the serial device must be opened with O_NONBLOCK flag.
Later this flag must be cleared before write operations otherwise
only small chunks data can be written at once.
Tested on OS X (10.8.4).

Author : Piotr Wilczek <p.wilczek@samsung.com>

Change-Id: I2b77cf16aacd491af9c94203fe7dfc49ce361516
Signed-off-by: jaehoon.you <jaehoon.you@samsung.com>
AUTHORS
CMakeLists.txt
NOTICE
lthor.c
packaging/lthor.spec

diff --git a/AUTHORS b/AUTHORS
index 1a1d5ef8e29636cab0dc1709d5200510cbd688f6..c9326d1ebd48ba924e89bed6eca4f916dd6bf4b7 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,3 +1,4 @@
 Jaehoon You <jaehoon.you@samsung.com>
 Karol Lewandowski <k.lewandowsk@samsung.com>
 Rafal Krypa <r.krypa@samsung.com>
+Piotr Wilczek <p.wilczek@samsung.com>
index 5bd246e2d2353802832e5e6aa1b1dadd1859fbe4..5b36e6931bd0929f31b497a6cd29a52c3771d470 100755 (executable)
@@ -13,7 +13,7 @@ SET(PKGNAME "${PACKAGE}")
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(BINDIR "${PREFIX}/bin")
 
-SET(PACKAGE_VERSION "1.3")
+SET(PACKAGE_VERSION "1.4")
 
 
 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
@@ -43,7 +43,11 @@ ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
 ADD_DEFINITIONS("-DPACKAGE_VERSION=\"${PACKAGE_VERSION}\"")
 
 #SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
-SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed")
+IF(APPLE)
+       SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
+ELSE()
+       SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed")
+ENDIF()
 
 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
diff --git a/NOTICE b/NOTICE
index 0e0f016a0659eecc81519f565641583b15f49970..d18014eb6038f62113173828717cee28a75b682e 100644 (file)
--- a/NOTICE
+++ b/NOTICE
@@ -1,3 +1,16 @@
 Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
 Except as noted, this software is licensed under Apache License, Version 2.
 Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
+
+----------------------------------------------------------------------------
+<OS X>
+
+(Requirements: OS X 10.7, 10.8)
+For OS X 'pkg-config' package is required. It can be downloaded from:
+http://www.freedesktop.org/wiki/Software/pkg-config/
+
+The libarchive download is available at:
+http://www.libarchive.org/
+
+On OS X always execute lthor with -d /dev/cu.MYDEV
+ex) lthor -d /dev/cu.SAMSUNG_VSP *.tar
diff --git a/lthor.c b/lthor.c
index d97e2dfa0e2a71958acb6a13164ef4b6291dc403..48c40cef05d7d2a35310942999aa924ab521bf39 100755 (executable)
--- a/lthor.c
+++ b/lthor.c
@@ -183,6 +183,9 @@ int send_chunks(int fd, struct data_src *senddata, size_t size)
 
                r = write(fd, chunk, trans_unit_size);
                if (r != trans_unit_size) {
+                       if (r > 0)
+                               fprintf(stderr, "line %d: %d bytes requested, %d written\n",
+                                               __LINE__, trans_unit_size, r);
                        fprintf(stderr, "line %d: failed to send data\n", __LINE__);
                        free(chunk);
                        return -1;
@@ -577,11 +580,20 @@ int open_port(const char *portname, int wait)
                }
 
                if (dev) {
-                       fd = open(dev, O_RDWR);
+                       /* On OS X open serial port with O_NONBLOCK flag */
+                       fd = open(dev, O_RDWR | O_NONBLOCK);
+
                        if (fd == -1) {
                                perror("port open error!!\n");
                                return -1;
                        }
+
+                       /*now clear the O_NONBLOCK flag to enable writing big data chunks at once*/
+                       if (fcntl(fd, F_SETFL, 0)) {
+                               printf("line %d: error clearing O_NONBLOCK\n", __LINE__);
+                               return -1;
+                       }
+
                        break;
                }
 
index 2898c4985cecbb36491d42d1e8e0074f4970f613..a79a512fee11d65d8a76c859438537da387c325b 100644 (file)
@@ -3,7 +3,7 @@
 #
 Name:          lthor
 Summary:       Flashing tool for Tizen lunchbox
-Version:       1.3
+Version:       1.4
 Release:       1
 Group:         Development/Tools/Other
 License:       Apache