tools/lthor.git
6 years agoFix to check protocol version before refusing large file 04/177604/3
Seung-Woo Kim [Wed, 2 May 2018 06:02:12 +0000 (15:02 +0900)]
Fix to check protocol version before refusing large file

From protocol version 5.0, it will be supported large file size
with 64bit value. Fix to check protocol version before resuing
large file.

Change-Id: Ie2b76d5e857c143289332e543bb65254ac522081
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoUpdate for THOR 5.0 support 05/177605/3
Seung-Woo Kim [Mon, 30 Apr 2018 05:57:58 +0000 (14:57 +0900)]
Update for THOR 5.0 support

Until THOR 4.0, it uses only 32bit to send file size. From THOR
5.0, it starts to use two 32bit variables for the file size.
Update for the THOR 5.0 protocol support.

Change-Id: I3569d51179bb75b034a62f902e8640a1232d6ed3
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoFix overflow of filename 17/179317/2
Seung-Woo Kim [Thu, 17 May 2018 06:06:46 +0000 (15:06 +0900)]
Fix overflow of filename

In thor protocol, only filename with 32 characters is allowed to
send but there was overflow of filename more than 32 and it is
crashed with 193 or longer length filename. Fix the overflow of
filename.

Note: ARTIK530 and ARTIK710 already misuse overflowed 33 length dtb
filename, and exact modification as thor protocol breaks flashing
on the boards. So fix with extention for the ARTIK borads by
appending more 32 bytes in rqt_pkt.str_data[1] as artik u-boot
expects.

Change-Id: I4081024cafa276617497091e00cbb6fbc21348b7
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoFix wrong close for negative file descriptor 97/178297/3
Dongwoo Lee [Wed, 9 May 2018 06:21:34 +0000 (15:21 +0900)]
Fix wrong close for negative file descriptor

There is an issue which negative file descriptor can be attempt to
close in static analysis tool result. This patch fixes to skip close
on that case.

Change-Id: Ic68803bc96ab6e3737d1bcc4779b8e3c58c7ef71
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
6 years agoFix uninitialized data in error ret value 96/178296/3
Seung-Woo Kim [Wed, 9 May 2018 05:27:05 +0000 (14:27 +0900)]
Fix uninitialized data in error ret value

There is uninitialized data issue in static analysis tool result.
Fix the uninitialized data in error ret value.

Change-Id: I7e5e0f6fa372c125c5ce6eb8df321cb08919b9cf
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoFix use of deprecated libarchive function calls 49/177849/2
Dongwoo Lee [Mon, 25 Sep 2017 08:21:35 +0000 (17:21 +0900)]
Fix use of deprecated libarchive function calls

To get rid of build warning about deprecated funcations of libarchive,
this patch replaces those function calls with alternative ones.

Change-Id: I164c60243e20fcbbdad2185a14534fe7a4daf9d8
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
7 years agoFix progress report for larger than 2GB file 96/124096/2
Seung-Woo Kim [Mon, 10 Apr 2017 07:38:43 +0000 (16:38 +0900)]
Fix progress report for larger than 2GB file

Currently, progress report function has 32bit signed value for its
send and left parameters, so it causes negative value progress. This
fixes the parameters as unsigned 32bit type to report properly.

Change-Id: I1d291c1507170c57b025d4fbd91098b48a97cdd0
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agoFix description for short version of params 62/86862/2 release-20160930
Krzysztof Opasiak [Mon, 5 Sep 2016 08:44:46 +0000 (10:44 +0200)]
Fix description for short version of params

Change-Id: I8a06e7c231f1134d2892dade182fec2b313bc630
Reported-by: Donghoon Shin <dhs.shin@samsung.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoFix busid param parsing 47/86847/1
Krzysztof Opasiak [Mon, 5 Sep 2016 07:10:16 +0000 (09:10 +0200)]
Fix busid param parsing

Change-Id: Ia3e6047ccd9f07d1a834c4eb58408d0afca1c8c3
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoFix memleak of entry name 69/86769/2
Krzysztof Opasiak [Fri, 2 Sep 2016 16:40:37 +0000 (18:40 +0200)]
Fix memleak of entry name

Change-Id: I57fe94546759888697871fa716e865771801b00b
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoFix file testing 68/86768/2
Krzysztof Opasiak [Fri, 2 Sep 2016 16:38:59 +0000 (18:38 +0200)]
Fix file testing

Change-Id: Ide8250910005c37a6ecadcb81d4d3b8e1e646bda
Reported-by: Tomasz Wozniak <t.wozniak@samsung.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoFix double free on error condition 67/86767/2
Krzysztof Opasiak [Fri, 2 Sep 2016 16:22:35 +0000 (18:22 +0200)]
Fix double free on error condition

Change-Id: I41224563de4d6176e60a5f4c893560e3dcf96b86
Reported-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoFix memleak of entries array 66/86766/1
Krzysztof Opasiak [Fri, 2 Sep 2016 13:54:58 +0000 (15:54 +0200)]
Fix memleak of entries array

Change-Id: I39259e1bdd48fc2a75cdb6652e918cef2775774c
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoUpdate package build configuration release-20160808
Krzysztof Opasiak [Mon, 9 May 2016 13:53:40 +0000 (15:53 +0200)]
Update package build configuration

Based on initial work by Seung-Woo Kim <sw0312.kim@samsung.com>.

Change-Id: I8eaa2e5d726aff359de221d1bce203439bcacd05
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoBump lthor version to 2.0
Krzysztof Opasiak [Thu, 7 Jul 2016 13:27:11 +0000 (15:27 +0200)]
Bump lthor version to 2.0

Due to major changes in lthor implementation let's bump
version to 2.0

Change-Id: I7b39080031c499a7e9f0899b32918d682d5f7497
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAllow to print also content of tar file
Krzysztof Opasiak [Mon, 16 May 2016 16:41:24 +0000 (18:41 +0200)]
Allow to print also content of tar file

Old implementation of lthor was printing not only name of
tar file and it's size but also name of each entry and it's
size. This patch allows also new implementation to do this.

Change-Id: I05c12fb5368bcaaaeeb93a3116d9322ecc4349b1
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd support for large files
Krzysztof Opasiak [Fri, 13 May 2016 12:19:08 +0000 (14:19 +0200)]
Add support for large files

Currently session size is send over USB as integer 32b.
So max size of all files is 2GB.
Some fixed uboot versions treat this value as unsigned integer 32b.
So there max size of all files is 4GB.

Let's provide initial support for large files in lthor by
counting all size using off_t which thanks to define is 64b
on all platforms.

This patch also add a suitable warning if image is larger than
2GB and reports an error if image is larger than 4GB.

Change-Id: I402b3684fa96c7531edb580e38f109ecc8a5ebd0
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoImprove colors handling in terminal
Krzysztof Opasiak [Fri, 13 May 2016 12:12:05 +0000 (14:12 +0200)]
Improve colors handling in terminal

Instead of repeating magick strings in many places
let's use a suitable defines for them to make the code
more readable.

Change-Id: I7b4935bd459e375be39d1dd223d20c71635670cc
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoUse asynchronous API to improve performance
Krzysztof Opasiak [Fri, 13 May 2016 08:28:28 +0000 (10:28 +0200)]
Use asynchronous API to improve performance

Change-Id: I18f0aa14778d06751e7005e4b555c6c68f2839d4
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoStart using new implementation of thor protocol
Krzysztof Opasiak [Thu, 2 Jun 2016 09:43:22 +0000 (11:43 +0200)]
Start using new implementation of thor protocol

Drop all legacy stuff which used cdc-acm kernel driver
and start using new implementation provided by libthor.

Change-Id: If3ee224b4905778d39c8b049f38353f499cd9f9f
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd core file with thor communication protocol
Krzysztof Opasiak [Mon, 9 May 2016 11:22:45 +0000 (13:22 +0200)]
Add core file with thor communication protocol

Add main file of libthor with implementation of API and thor
communication protocol.

Change-Id: Ic6e4c13ad89eef8080f955af5a71c11cd201ad78
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd cdc-acm related implementation of thor protocol
Krzysztof Opasiak [Fri, 13 May 2016 08:39:43 +0000 (10:39 +0200)]
Add cdc-acm related implementation of thor protocol

Thor protocol "emulates" cdc-acm class. This commit adds
some helper functions which are required to properly
setup communication on cdc-acm protocol level.

Change-Id: Iffb79c813f97bc3f3c4260f6fd713d0ea4d99353
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd libusb backend for thor protocol
Krzysztof Opasiak [Fri, 13 May 2016 08:27:23 +0000 (10:27 +0200)]
Add libusb backend for thor protocol

Add implementation of functions used for communication
with tharget on USB level via libusb.

Change-Id: I59603b3bb05570e8f13c8ca3e4f48fabf2fc03c0
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd code for accessing tar archives
Krzysztof Opasiak [Mon, 9 May 2016 11:20:25 +0000 (13:20 +0200)]
Add code for accessing tar archives

Add implementation of data source for accessing tar files.
This is needed to flash tar.gz file using lthor.

Change-Id: Id5abbf258d41f37c569c65753bb8866bb9a84b6a
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd code for accessing raw file by liblthor
Krzysztof Opasiak [Fri, 13 May 2016 08:27:03 +0000 (10:27 +0200)]
Add code for accessing raw file by liblthor

Implement a data source for accessing standard file.
This type of access is used for reading PIT file.

Change-Id: Icc9de3718e1234e0758c27f4721f3072d3d538f9
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd headers with API for new implementation of thor protocol
Krzysztof Opasiak [Mon, 9 May 2016 11:19:28 +0000 (13:19 +0200)]
Add headers with API for new implementation of thor protocol

Add new headers with:
- API for accessing new implementation of thor protocol
- Internal data structure which will be used by libthor

Copy also header with definitions of messages used by thor
protocol.

Change-Id: I0e6901a45737e3711f9328f757f76de96b88bdd3
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoUse getopt_long() to parse cmd line
Krzysztof Opasiak [Fri, 18 Mar 2016 16:35:19 +0000 (17:35 +0100)]
Use getopt_long() to parse cmd line

Use a standard linux way of parsing cmd line arguments
to avoid unnecessary code.

Change-Id: I64325e7804048c1abce013f78df5163ee4af85c8
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd gitignore
Krzysztof Opasiak [Tue, 22 Mar 2016 09:15:08 +0000 (10:15 +0100)]
Add gitignore

Change-Id: I4126d7a25a29414dc92f776da7c2d34c731e2fa9
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoUpdate lthor version
Jaewon Kim [Fri, 31 Oct 2014 09:17:52 +0000 (18:17 +0900)]
Update lthor version

This patch update lthor version to 1.5

Change-Id: Ie25e95b6fd5e4a601c64bdf8c4a3d66f0ed64005
Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
8 years agoAdd to pass abnormal file
Jaewon Kim [Fri, 31 Oct 2014 05:29:02 +0000 (14:29 +0900)]
Add to pass abnormal file

When trying abnormal file(not matched with pit) download,
lthor pass this file.

Change-Id: Ib3c46fdd2f82a4299dfbfcaa9ad64f4b30accb56
Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
8 years agoAdd ttyACM check for lthor
Jaewon Kim [Fri, 12 Sep 2014 10:27:52 +0000 (19:27 +0900)]
Add ttyACM check for lthor

This patch add ttyACM check to find correct port for lthor
even if there are several ttyACM port.

Change-Id: Icb87a9ebbabec2e5fa7c3312efff972488dbc3d1
Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
8 years agoRemove vendor and product match code
Jaewon Kim [Thu, 11 Sep 2014 08:59:32 +0000 (17:59 +0900)]
Remove vendor and product match code

This patch remove vendor and product ID checking code
to support various boards

Change-Id: I6e1bca14e504a072f93d661666a9c623802ef472
Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
8 years agoUpdate URL in spec file
Gaurav Kalra [Sun, 16 Jun 2013 12:05:04 +0000 (17:35 +0530)]
Update URL in spec file

Change-Id: I6913146ba412e2514b0e99c50908a2441f4c9fd0

8 years agoCorrecting usage help for check protocol
Gaurav Kalra [Wed, 19 Jun 2013 16:41:13 +0000 (22:11 +0530)]
Correcting usage help for check protocol

Change-Id: If17ad57e29b50f01011c3435c81fb8f522eaa0b4

10 years agoIncreased version in debian/changelog 92/13492/1 release-20160315 release-20160411 release-20160531 release-20160615 release-test-0.1 release-test-20150810
Ed Bartosh [Sun, 8 Dec 2013 17:01:39 +0000 (19:01 +0200)]
Increased version in debian/changelog

Change-Id: Ic49555ddc4d72ed837e78b6a953293c412394a34
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
11 years agoSupport MAC OS X 10.7,10.8 91/13491/1
jaehoon.you [Fri, 11 Oct 2013 09:07:57 +0000 (18:07 +0900)]
Support MAC OS X 10.7,10.8

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>
11 years agoFixed packaging 90/13490/1
Ed Bartosh [Mon, 28 Oct 2013 14:25:57 +0000 (16:25 +0200)]
Fixed packaging

No need in Makefile and .dsc file as we're using git-buildpackage
service in Jenkins job.

Change-Id: Ie417a54693dd9ab4a6b5c372c8563b66a4a6d801
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
11 years agoFixed OpenSUSE 1.23 build 89/13489/1
Ed Bartosh [Thu, 25 Apr 2013 13:53:54 +0000 (16:53 +0300)]
Fixed OpenSUSE 1.23 build

Change-Id: I462628a57597e2cc8892bd705fdbf426361cf024
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
11 years agoFixed deb packaging issues found by lintian 88/13488/1
Ed Bartosh [Thu, 25 Apr 2013 13:27:00 +0000 (16:27 +0300)]
Fixed deb packaging issues found by lintian

The following changes have been made:
- removed libc6-dev from the list of build dependencies as it is
  build essential
- Used real Standard-Version
- Used misc:Depends macro
- Updated short description
- Added long description
- Updated package version

Change-Id: Ifa1a52d4e2f109255aa4d1ecb68dc166b57ffa42
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
11 years agoChange AUTHORS
jaehoon.you [Tue, 2 Apr 2013 12:08:30 +0000 (21:08 +0900)]
Change AUTHORS

Change-Id: Ib2991a1a6844e5a1827268f0fb4a8303c18f8269
Signed-off-by: jaehoon.you <jaehoon.you@samsung.com>
11 years agoFix and Add some error message
jaehoon.you [Tue, 2 Apr 2013 11:55:28 +0000 (20:55 +0900)]
Fix and Add some error message

1. In some cases, lthor needs enough memory
(Reported by Vyacheslav Barinov in SRR)
So, notify message added.
2. fix print format about error message.

Change-Id: I42fcea8c21d4183e8909293d2101cebd19ef9dc5
Signed-off-by: jaehoon.you <jaehoon.you@samsung.com>
11 years agoAdd udev rules for supporting Ubuntu 12.10
jaehoon.you [Tue, 2 Apr 2013 11:43:07 +0000 (20:43 +0900)]
Add udev rules for supporting Ubuntu 12.10

In Ubuntu 12.10, modem-manager interrupt and close Tizen device.
so, add exceptional udev rules for ttyACM connection.

lthor Version 1.2 -> 1.3

Change-Id: I0c88084a8ff0f2e2f39d2b76e6568a81cf1a3e87
Signed-off-by: jaehoon.you <jaehoon.you@samsung.com>
11 years agoIncluded udev rules into packages
Ed Bartosh [Mon, 28 Jan 2013 08:31:26 +0000 (10:31 +0200)]
Included udev rules into packages

Udev rules set device mode to 0666 in order to give flashing
permissions to everyone. This is handy for developers to being able to
flash devices from user account.

Change-Id: Ibb3ccb6b54c3f3c56df66ad0d17772806f622129
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
11 years agoUpdated licence information
Ed Bartosh [Mon, 3 Dec 2012 14:12:07 +0000 (16:12 +0200)]
Updated licence information

Used Apache 2.0 licence for deb and rpm packaging.

Change-Id: I1b54726fa3a13c6752ae76eb3c9f9407708f58f4
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
11 years ago[Prevent] fix Tizen 35853, and update authors list
jaehoon.you [Wed, 9 Jan 2013 06:54:42 +0000 (15:54 +0900)]
[Prevent] fix Tizen 35853, and update authors list

Tizen 35853 : DEADCODE
original code is "assert(chunksize > 0 && chunksize <= trans_unit_size);"
(reference send_chunks() : line 125)
but chunksize already checked before line:1086 (chunksize <= 0)
then, chunksize always bigger than 0 .
so, exclamation mark is moved to another location
and conditional sentence is switched.

Change-Id: I9e5a2f998fb506fd152da856f4c9455f027207a6
Signed-off-by: jaehoon.you <jaehoon.you@samsung.com>
11 years agochange license file name
Chanho Park [Wed, 23 Jan 2013 07:04:39 +0000 (16:04 +0900)]
change license file name

This patch changes license file name which has meaning of license.

Change-Id: I832a1bfddf65aad2e1765d1b5ba5685f21e39241
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
11 years agoadd license/author informations
Chanho Park [Tue, 15 Jan 2013 01:29:55 +0000 (10:29 +0900)]
add license/author informations

This commit adds license files based on APLv2 license.

Change-Id: Ie80e337479f31660cf6298f7f3ed25fcee985356
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
11 years ago[Prevent] fix Tizen 36515,36516,37705 - STRING_OVERFLOW, RESOURCE_LEAK
jaehoon.you [Tue, 8 Jan 2013 11:37:24 +0000 (20:37 +0900)]
[Prevent] fix Tizen 36515,36516,37705 - STRING_OVERFLOW, RESOURCE_LEAK

Change-Id: I184458fd8419d4e32a9a493f2258dbbdd2637980
Signed-off-by: jaehoon.you <jaehoon.you@samsung.com>
11 years agoMerge "Added option to check protocol availability"
YoungJin Lee [Tue, 20 Nov 2012 23:54:00 +0000 (08:54 +0900)]
Merge "Added option to check protocol availability"

11 years agoPackaged for Debian and Ubuntu
Ed Bartosh [Mon, 12 Nov 2012 17:11:46 +0000 (19:11 +0200)]
Packaged for Debian and Ubuntu

Change-Id: I5f99117eb0bd506dd1d83d691a0b0e9c5f08c944
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
12 years agoPackaged for rpm distros
Ed Bartosh [Tue, 6 Nov 2012 16:37:48 +0000 (18:37 +0200)]
Packaged for rpm distros

This is a first commit regarding packaging. It implements packaging for
RPM. Debian packaging will follow.

Change-Id: Ibe45191cd3d06c387c6000c45c1b56ff820d0a87
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
12 years agoAdded option to check protocol availability
Ed Bartosh [Tue, 6 Nov 2012 12:51:02 +0000 (14:51 +0200)]
Added option to check protocol availability

This is a first draft(not working yet) to implement a check for LTHOR protocol.
It's needed by our testing software. It should be able to first check if device
is in flashable mode and then perform flashing by running lthor <image.tar>.

To implement this feature correctly I need your help. Is there any way
in THOR protocol to inform the device that it should again wait for
handshake? If I just perform handshake and get information from the
device it will not be possible to flash it after that, because it will
be in active mode, waiting for the commands, not for the handshake.

Is it possible to contact you by email or this is the only communication
channel I can use?

Thank you,
Ed

Change-Id: Ic4cfa954885408343b5aad20fa805b2788c49ee7
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
12 years agoinitial commit of lthor
YoungJin Lee [Fri, 2 Nov 2012 10:55:18 +0000 (19:55 +0900)]
initial commit of lthor

Change-Id: Ifd62a81919f2a88a22b38627dd467d53c5408823

12 years agoInitial empty repository
Jung Minsun [Wed, 31 Oct 2012 02:13:51 +0000 (11:13 +0900)]
Initial empty repository