platform/core/api/usb-host.git
9 years agoMerge "tests: add libhusb_{get,free}_config_descriptor test" into tizen_2.4 sandbox/klewandowski/old_tizen
Stanislaw Wadas [Mon, 2 Nov 2015 13:02:23 +0000 (22:02 +0900)]
Merge "tests: add libhusb_{get,free}_config_descriptor test" into tizen_2.4

9 years agoMerge "tests: add a better libhusb_close test" into tizen_2.4
Stanislaw Wadas [Mon, 2 Nov 2015 11:37:55 +0000 (20:37 +0900)]
Merge "tests: add a better libhusb_close test" into tizen_2.4

9 years agoMerge "tests: fix libhusb_release_interface tests" into tizen_2.4
Stanislaw Wadas [Mon, 2 Nov 2015 10:10:52 +0000 (19:10 +0900)]
Merge "tests: fix libhusb_release_interface tests" into tizen_2.4

9 years agoMerge "libhusb: fix warning spelling (helps greppability)" into tizen_2.4
Stanislaw Wadas [Mon, 2 Nov 2015 10:08:40 +0000 (19:08 +0900)]
Merge "libhusb: fix warning spelling (helps greppability)" into tizen_2.4

9 years agoMerge "tests: improve transfer tests" into tizen_2.4
Stanislaw Wadas [Mon, 2 Nov 2015 10:08:04 +0000 (19:08 +0900)]
Merge "tests: improve transfer tests" into tizen_2.4

9 years agotests: add libhusb_{get,free}_config_descriptor test
Michal Bloch [Mon, 26 Oct 2015 17:45:42 +0000 (18:45 +0100)]
tests: add libhusb_{get,free}_config_descriptor test

Change-Id: I910e7d899ba69b5a284a005e2b114f3a3217fc1c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
9 years agotests: add a better libhusb_close test
Michal Bloch [Tue, 27 Oct 2015 18:32:35 +0000 (19:32 +0100)]
tests: add a better libhusb_close test

Since libhusb_device_open_with_vid_pid creates
a device handle with the necessary properties,
i.e. containing a real libusb_device_handle, it
can be used for the libhusb_close test.

This also fixes a memory leak because the handle
was not else deallocated.

The old libhusb_close test (manual allocation
of the libusb_device_handle) stays because it
allows more flexibility as we have control over
what the libusb_device_handle contains, unlike
when using libhusb_device_open_with_vid_pid.

Change-Id: Ic2a77f458023e1e3099ff2e2623fa35730e6bebb
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
9 years agotests: fix libhusb_release_interface tests
Michal Bloch [Mon, 26 Oct 2015 16:43:49 +0000 (17:43 +0100)]
tests: fix libhusb_release_interface tests

The kernel driver attachment part of the
function was ignored, which would sometimes
lead to the test failing when the attachment
was called - this happened randomly because
the value was never initialized.

The simple test for libhusb_release_interface
is changed to make sure it does not check this
scenario. A new sub-test is added to do so.
The invalid arguments test is unaffected as it
never gets to the kernel driver attachment part.

Change-Id: I3628942b436940508ab5b93a76cc59b596645f2a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
9 years agolibhusb: fix warning spelling (helps greppability)
Michal Bloch [Fri, 23 Oct 2015 15:50:27 +0000 (17:50 +0200)]
libhusb: fix warning spelling (helps greppability)

Make sure all failures have the same spelling.

This makes searching for errors easier, as search
for the correct word will now consistently find
all outstanding errors.

Change-Id: I8c31ff44aa8b64944923571cd41088dc4c6db53c
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
9 years agotests: improve transfer tests
Michal Bloch [Fri, 23 Oct 2015 12:10:47 +0000 (14:10 +0200)]
tests: improve transfer tests

Make transfer tests check
transferred bytes output value
returned by function

Change-Id: Id534a4d2015e49dc740054087a89168623997ba9
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
9 years agoMerge "tests: add libhusb_{release,claim}_interface invalid param tests" into tizen_2.4
Stanislaw Wadas [Fri, 23 Oct 2015 12:26:50 +0000 (21:26 +0900)]
Merge "tests: add libhusb_{release,claim}_interface invalid param tests" into tizen_2.4

9 years agoMerge "tests: add libhusb_get_string_descriptor_ascii test" into tizen_2.4
Stanislaw Wadas [Thu, 22 Oct 2015 15:01:44 +0000 (00:01 +0900)]
Merge "tests: add libhusb_get_string_descriptor_ascii test" into tizen_2.4

9 years agotests: add libhusb_{release,claim}_interface invalid param tests
Michal Bloch [Thu, 22 Oct 2015 11:08:52 +0000 (13:08 +0200)]
tests: add libhusb_{release,claim}_interface invalid param tests

Change-Id: I35eb285e7b2ca03831ec656a729b3776274f85ff
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
9 years agotests: add libhusb_get_string_descriptor_ascii test
Michal Bloch [Thu, 22 Oct 2015 10:49:17 +0000 (12:49 +0200)]
tests: add libhusb_get_string_descriptor_ascii test

Change-Id: Iacffc303ea24b1b5de528a556fb9a9f718a46687
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
9 years agoMerge "tests: Add libhusb_close test" into tizen_2.4
Stanislaw Wadas [Thu, 22 Oct 2015 12:09:34 +0000 (21:09 +0900)]
Merge "tests: Add libhusb_close test" into tizen_2.4

9 years agoMerge "tests: minor fixes" into tizen_2.4
Stanislaw Wadas [Thu, 22 Oct 2015 11:04:24 +0000 (20:04 +0900)]
Merge "tests: minor fixes" into tizen_2.4

9 years agoMerge "tests: Run tests in verbose mode" into tizen_2.4
Stanislaw Wadas [Thu, 22 Oct 2015 10:26:09 +0000 (19:26 +0900)]
Merge "tests: Run tests in verbose mode" into tizen_2.4

9 years agotests: Add attach kernel driver test
Stanislaw Wadas [Tue, 6 Oct 2015 14:00:40 +0000 (16:00 +0200)]
tests: Add attach kernel driver test

Change-Id: I3726a098b201c02afe7db4e03abaedc9da1f0c6d
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agotests: Add detach kernel driver test
Stanislaw Wadas [Tue, 6 Oct 2015 13:53:25 +0000 (15:53 +0200)]
tests: Add detach kernel driver test

Change-Id: I395b898b7ecc9e70e7b457bb98dca9c601ab5d89
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agotests: Add kernel driver active test
Stanislaw Wadas [Tue, 6 Oct 2015 13:45:04 +0000 (15:45 +0200)]
tests: Add kernel driver active test

Change-Id: I350eadabaaace5fa4251ad86bb6263d166492b20
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agotests: Add reset device test
Stanislaw Wadas [Tue, 6 Oct 2015 13:18:51 +0000 (15:18 +0200)]
tests: Add reset device test

Change-Id: I3ee71e6c6290d139f6d88b202577b763d2ba5d2c
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agotests: Add clear halt test
Stanislaw Wadas [Tue, 6 Oct 2015 11:39:21 +0000 (13:39 +0200)]
tests: Add clear halt test

Change-Id: I1a6dc5e6cba7cd61b948c05ca6ca8cdd1df9ee7c
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agotests: Add simple interrupt transfer test
Stanislaw Wadas [Tue, 6 Oct 2015 10:54:16 +0000 (12:54 +0200)]
tests: Add simple interrupt transfer test

Change-Id: Ife4a5398d5a495adadbb2d0594a524c81fd0eb8a
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agotests: Add simple release interface test
Stanislaw Wadas [Tue, 6 Oct 2015 10:47:49 +0000 (12:47 +0200)]
tests: Add simple release interface test

Change-Id: If01ef56f508b42aaa6b3e0936593dde54d6e9d24
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agotests: Add simple bulk transfer test
Stanislaw Wadas [Tue, 6 Oct 2015 09:59:09 +0000 (11:59 +0200)]
tests: Add simple bulk transfer test

Change-Id: Ie70dd75e8479306a4ee2d0140e94c40357061f4e
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agotests: Add get port numbers test
Stanislaw Wadas [Thu, 8 Oct 2015 08:25:31 +0000 (10:25 +0200)]
tests: Add get port numbers test

Change-Id: Ia5b4c568345f682feb78305354ef3164db805a7a
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agofix: add missing function implementation
Stanislaw Wadas [Tue, 6 Oct 2015 10:15:20 +0000 (12:15 +0200)]
fix: add  missing function implementation

add libhusb_get_port_numbers() implementation

Change-Id: I66199bfdf173c3f234c168ce7dc3eb7e77f46a1b
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agotests: Add libhusb_close test
Michal Bloch [Mon, 19 Oct 2015 13:49:41 +0000 (15:49 +0200)]
tests: Add libhusb_close test

Change-Id: I2dbbcda98a01d053de80e39869d28e175205f6c2
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
9 years agotests: Run tests in verbose mode
Pawel Szewczyk [Tue, 20 Oct 2015 11:32:55 +0000 (13:32 +0200)]
tests: Run tests in verbose mode

As reaching failed tests log while cross compiling in separate environment
is not very convienient, tests are now run in verbose mode.

Change-Id: I9a4abb73f385517b024c8d927f5de2a2884243af
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
9 years agotests: minor fixes
Michal Bloch [Thu, 15 Oct 2015 17:59:24 +0000 (19:59 +0200)]
tests: minor fixes

* make sure an array is always of the appropriate size
  by replacing a duplicate constant with a named identifier.
* initialize tested values for a more uniform distribution.

Change-Id: I2f195b25076b119deaf64f3c17b1ab6b4dee8200
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
9 years agotests: Add control_transfer test
Pawel Szewczyk [Thu, 1 Oct 2015 15:02:08 +0000 (17:02 +0200)]
tests: Add control_transfer test

Change-Id: I37ab9dd661028575c4f1e8a3708d4c8112dbc2a6
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
9 years agotests: Add claim_interface test
Pawel Szewczyk [Thu, 1 Oct 2015 15:02:04 +0000 (17:02 +0200)]
tests: Add claim_interface test

Change-Id: I19f000062c02f6d1f9d96c8bbadc72f33a5b9d02
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
9 years agotests: Add test of set_config
Pawel Szewczyk [Thu, 1 Oct 2015 12:06:46 +0000 (14:06 +0200)]
tests: Add test of set_config

Change-Id: I6d623eb2bdfb6c63f2216f20ba9b65052f92972f
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
9 years agotests: Add test of getting device by vid and pid
Pawel Szewczyk [Thu, 1 Oct 2015 11:26:13 +0000 (13:26 +0200)]
tests: Add test of getting device by vid and pid

Change-Id: Ieed35e48ae50b00ae8461b52792cb1877873c1fd
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
9 years agotests: Build and run tests
Pawel Szewczyk [Thu, 1 Oct 2015 09:26:17 +0000 (11:26 +0200)]
tests: Build and run tests

Add tests to CMake files and add running them in packaging. Add
BUILD_TESTS flag to CMake.

Change-Id: I3d374a9b1e9a80416231acc54c1b4e59613bae5e
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
9 years agotests: Add get_active_config test
Pawel Szewczyk [Tue, 29 Sep 2015 14:08:18 +0000 (16:08 +0200)]
tests: Add get_active_config test

Change-Id: I77b0c502d708e90edf332fda6eec8dda29210aa6
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
9 years agotests: Add tests of api functions related to devices
Pawel Szewczyk [Tue, 29 Sep 2015 14:14:28 +0000 (16:14 +0200)]
tests: Add tests of api functions related to devices

Change-Id: Ia958746d202ea89844015f8bb468bde3d6bd09ff
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
9 years agotests: Add test of getting device list
Pawel Szewczyk [Thu, 24 Sep 2015 13:41:30 +0000 (15:41 +0200)]
tests: Add test of getting device list

Change-Id: Ie84a227e75093c78ab7b561a3ff0674e18bf10f4
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
9 years agotests: Add getting device test
Pawel Szewczyk [Thu, 24 Sep 2015 12:54:15 +0000 (14:54 +0200)]
tests: Add getting device test

Change-Id: If61331c16b98393aa93f64433a8f73da157e4a5b
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
9 years agotests: Add device opening test
Pawel Szewczyk [Mon, 28 Sep 2015 11:55:18 +0000 (13:55 +0200)]
tests: Add device opening test

Change-Id: I899aaac5a216fc5d62f23674b0e83f927e64fd83
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
9 years agotests: Add basic tests
Pawel Szewczyk [Mon, 28 Sep 2015 11:57:34 +0000 (13:57 +0200)]
tests: Add basic tests

Change-Id: I410c5e796f3e7dfd095c1b877db2dd607714d2d5
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
9 years agotests: Add mock implementation of libusb
Pawel Szewczyk [Mon, 28 Sep 2015 11:39:42 +0000 (13:39 +0200)]
tests: Add mock implementation of libusb

Instead of using real libusb, we prepare simple mock version of the
library. It allows to control behavior of functions using cmocka,
creating environment for testing host capi.

Functions added here are mostly to be implemented with corresponding
test cases.

Change-Id: If9825c5dc2b24963cccc17ba023891b459fcf969
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
9 years agoinclude: Add libhusb_internal.h
Pawel Szewczyk [Mon, 28 Sep 2015 11:33:35 +0000 (13:33 +0200)]
include: Add libhusb_internal.h

For convenience of testing, internal data structures are moved to
separate header. They are still used only internally, but can be
included in tests as well.

Change-Id: I419f155cd5c5251a716f3b8e430074309664a2e5
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
9 years agoSave policy to file and restore from it during startup
Stanislaw Wadas [Fri, 4 Sep 2015 09:31:34 +0000 (11:31 +0200)]
Save policy to file and restore from it during startup

This change is needed as USD exits if no communication is processed.
As for now, all the policy was stored in USD process memory.
Now it is necassary to save it.
As for now store the policy in /run/usb-security-daemon.
This will cause reset of policy after each device reset.

Change-Id: Id8c8c5e00944f3530333a7410bda0250681d8baf
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
9 years agoUSD: Add const identifier to functions that does not alter objects
Jan Cybulski [Fri, 31 Jul 2015 13:16:47 +0000 (15:16 +0200)]
USD: Add const identifier to functions that does not alter objects

Change-Id: I78049ca207c629b6ca7b020bf382509628f474a6
Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
9 years agoAdd some error reports in logs
Jan Cybulski [Mon, 27 Jul 2015 10:18:30 +0000 (12:18 +0200)]
Add some error reports in logs

This might be useful in debugging.

Change-Id: Id516a10e539717e769923084cf06d730b577998a
Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
9 years agoUSD: Add service for asking user for permission
Jan Cybulski [Fri, 31 Jul 2015 12:57:50 +0000 (14:57 +0200)]
USD: Add service for asking user for permission

Change-Id: Idc5f9f58e2804c37466a7ad58dee92d4414d53c8
Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agoUSD: Add dbus thread
Jan Cybulski [Tue, 14 Jul 2015 09:38:19 +0000 (11:38 +0200)]
USD: Add dbus thread

Add class for maintaining thread needed for dbus main loop.
Dbus communication is needed because popup mechanism used this IPC.

Change-Id: Ifd5c34dac3144906d156ad14e151f0684bfa790f
Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agofix: only two parameters returned by sscanf are valid
Stanislaw Wadas [Thu, 3 Sep 2015 09:44:03 +0000 (11:44 +0200)]
fix: only two parameters returned by sscanf are valid

Change-Id: I3decc002f0426bd1358aa1cec1de2cc797d01619
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agoAdd doxygen documentation
Stanislaw Wadas [Thu, 23 Jul 2015 14:39:20 +0000 (16:39 +0200)]
Add doxygen documentation

Change-Id: Ieb67d4889d2a567ee737d5ccc1f920bbd727dfe9
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agofix to allow -DBUILD_DOC_ONLY option run properly
Stanislaw Wadas [Tue, 28 Jul 2015 12:43:38 +0000 (14:43 +0200)]
fix to allow -DBUILD_DOC_ONLY option run properly

Change-Id: I4543eda5a655e55099c851388779952f4afc07cb
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agoFix parameter naming.
Stanislaw Wadas [Mon, 27 Jul 2015 15:45:17 +0000 (17:45 +0200)]
Fix parameter naming.

Change-Id: I47a2c2768f360c07c3166f38b8659979b633c3af
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agolog: add logs using dlog on libhusb apis
Taeyoung Kim [Wed, 29 Jul 2015 07:32:54 +0000 (16:32 +0900)]
log: add logs using dlog on libhusb apis

- When a developer uses the apis, they should check the error situation.
  When the developer uses IDE, dlog will be shown by default. Thus
  dlog is used to store logs of the apis

Change-Id: I279bd1b2104cff33420523141034dc20b1f0bd36
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
9 years agousd-commons: add dependency for smack and systemd-daemon
Taeyoung Kim [Fri, 24 Jul 2015 07:25:01 +0000 (16:25 +0900)]
usd-commons: add dependency for smack and systemd-daemon

- Build failure occurred on apps using libusb which uses libusd-commons
  due to the linking failure. Thus the dependency is needed

Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
Change-Id: Ie0e079a4b3eed3297c00d00f3fdc682968143de2

9 years agoexample: fix example app to be built alone
Taeyoung Kim [Fri, 17 Jul 2015 09:26:41 +0000 (18:26 +0900)]
example: fix example app to be built alone

- Example app (sample/test app) should be built alone
  to check whether or not the library is working well.

Change-Id: I1a0f22fa5a40985703afda6d2220bb7888a944cd
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
9 years agopc: add capi-system-usbhost.pc file
Taeyoung Kim [Fri, 17 Jul 2015 09:07:53 +0000 (18:07 +0900)]
pc: add capi-system-usbhost.pc file

- PC file is necessary for other apps to use apis.
  Thus capi-system-usbhost.pc is added.
- The name of the library is changed from "libhusb"
  to "capi-system-usbhost". The name would not be changed
  and the keyword "husb" which is used for header file and
  each api is not related with the library name.

Change-Id: I5ebd6bbc7992dff85b446abd6a4e05bf0a6694fe
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
9 years agoexample: remove example codes from the build list
Taeyoung Kim [Fri, 17 Jul 2015 08:59:15 +0000 (17:59 +0900)]
example: remove example codes from the build list

- Sample (test) app should be able to be build alone.
  Thus the code is removed from the CMakeLists.txt

Change-Id: I4090a0b98020b7c416c20ff370d185de79ec0fc7
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
9 years agoMerge changes I27162a2a,I56a065b0,Iab5ff37d,Iad96de01,Iea35c3d1
Stanislaw Wadas [Thu, 9 Jul 2015 14:45:27 +0000 (23:45 +0900)]
Merge changes I27162a2a,I56a065b0,Iab5ff37d,Iad96de01,Iea35c3d1

* changes:
  fix device path
  Fix: call release() when suitable
  Fix libhusb_get_config_descriptor()
  add udev rule
  remove unused dependencies

9 years agofix device path
Stanislaw Wadas [Thu, 9 Jul 2015 14:37:23 +0000 (16:37 +0200)]
fix device path

Change-Id: I27162a2abc134481912418ab8fba2935ccea1d6d
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agoFix device's minor and major reading from stat
Jan Cybulski [Thu, 9 Jul 2015 14:33:03 +0000 (16:33 +0200)]
Fix device's minor and major reading from stat

USB device files are special files.
st_rdev field is used for obtaining special files' minor and major,
not st_dev as it was done in the code so far.

Change-Id: Ieac5b984549cc1bb81011348ee762042583230ac
Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
9 years agoFix: call release() when suitable
Krzysztof Opasiak [Wed, 1 Jul 2015 18:58:19 +0000 (20:58 +0200)]
Fix: call release() when suitable

Change-Id: I56a065b085d0fcb472a314f8796e177751f9c1d9
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoFix libhusb_get_config_descriptor()
Krzysztof Opasiak [Wed, 1 Jul 2015 06:08:56 +0000 (08:08 +0200)]
Fix libhusb_get_config_descriptor()

Change-Id: Iab5ff37d7db9dec1b71b011b006e5473cfcf504b
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoadd udev rule
Stanislaw Wadas [Wed, 1 Jul 2015 12:33:09 +0000 (14:33 +0200)]
add udev rule

add udev rule to obtain 644 chmod and * smack label
for usb device nodes

Change-Id: Iad96de010a76cc249ff50c88d53acbbedb681571
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agoremove unused dependencies
Stanislaw Wadas [Wed, 1 Jul 2015 13:42:23 +0000 (15:42 +0200)]
remove unused dependencies

Change-Id: Iea35c3d192e8653f8ed3a81aac686372a1045a6d
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agoTemporary hack: always allow access to open file
Jan Cybulski [Wed, 1 Jul 2015 11:43:35 +0000 (13:43 +0200)]
Temporary hack: always allow access to open file

Change-Id: If74e05db05e22067f4dea9ec6391e3b66d0fb56d
Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
9 years agoadd sync transfer test program
Stanislaw Wadas [Wed, 24 Jun 2015 10:22:43 +0000 (12:22 +0200)]
add sync transfer test program

program allow to test sync transfer.
this program need to be run on host, on device side
there is need to create gadget with FunctionFS function
and start test daemon. source can be found :
https://github.com/torvalds/linux/blob/master/tools/usb/ffs-aio-example/simple/device_app/aio_simple.c

Change-Id: If9805cf8a0bcf58288dc2d58aca7bdb3a0ae4e65
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agoadd example: lsdev
Stanislaw Wadas [Fri, 22 May 2015 08:33:00 +0000 (10:33 +0200)]
add example: lsdev

this program list all usb devices, and perform
basic operations on them using libhusb CAPI

Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
Rebase example onto current HEAD

Change-Id: I6bf6eb14cdfe1062aa6fb739fdd03ddb6e849862
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoAdd implementation of libhusb_get_config_descriptor()
Krzysztof Opasiak [Tue, 30 Jun 2015 10:09:14 +0000 (12:09 +0200)]
Add implementation of libhusb_get_config_descriptor()

Add get and free config descriptor functions implementation

Change-Id: Icb87b9cd0965be9ad724b0c3aedbeeb0bdcb6de7
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoAdd API functions for opening device.
Krzysztof Opasiak [Tue, 30 Jun 2015 07:35:36 +0000 (09:35 +0200)]
Add API functions for opening device.

Based on Stanislaw Wadas commit.

Change-Id: Ie2d675645d31c17391f26717ea81c85e96f31263
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoAdd proper error return code
Krzysztof Opasiak [Tue, 30 Jun 2015 07:33:52 +0000 (09:33 +0200)]
Add proper error return code

Change-Id: Id97901d976b22929192059257709ad889f64123f
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoFix claiming interface with force option
Krzysztof Opasiak [Mon, 29 Jun 2015 17:34:29 +0000 (19:34 +0200)]
Fix claiming interface with force option

We cannot use this auto function because it afects all
interfaces of given device. Instead of let's handle this
by ourselves.

Change-Id: I6114ffe4114dc7338d146f9e17aa8259ccfa67fa
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoIntroduce device reference counting
Krzysztof Opasiak [Mon, 29 Jun 2015 17:06:25 +0000 (19:06 +0200)]
Introduce device reference counting

We should not free() usb devices explicity in
libhusb_free_devices() but just decrement their refcount
and free only if it is realy necessary.

Change-Id: I8474942e0305c25b8f41abb4dd018ce5bc05c9ec
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoAdd some common macros
Krzysztof Opasiak [Mon, 29 Jun 2015 17:05:27 +0000 (19:05 +0200)]
Add some common macros

Add ARRAY_SIZE() and container_of() macros to this project.

Change-Id: Ic1bad59c01f97c4b1a56bbf41d2df61ed3d9e506
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoDrop 3rd param from get_max_packet_size()
Krzysztof Opasiak [Mon, 29 Jun 2015 16:33:24 +0000 (18:33 +0200)]
Drop 3rd param from get_max_packet_size()

As we may call libusb_get_max_iso_packet_size() for
all types of endpoints and all results are correct let's
just drop 3rd param from our API function so we don't confuse
our users.

Change-Id: I6c4075e85728449a4e308af024cea18a35a46371
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoReplace unsigned char with uint8_t
Krzysztof Opasiak [Mon, 29 Jun 2015 16:24:58 +0000 (18:24 +0200)]
Replace unsigned char with uint8_t

Let's use suitable typedef for endpoint address type.

Change-Id: I7a3447a3f2b4e8df9ae2d76424e2c6a34f7ba272
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoRemove const from structures definitions
Krzysztof Opasiak [Mon, 29 Jun 2015 16:12:12 +0000 (18:12 +0200)]
Remove const from structures definitions

Change-Id: Ief72dfb2e20d907daa8c47afa6e927f842fd2905
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoAdd simple reference counting structure
Krzysztof Opasiak [Mon, 29 Jun 2015 12:10:56 +0000 (14:10 +0200)]
Add simple reference counting structure

Based on kernel struct kref but with embedded pointer to
release method instead of passing it in put() methods.

Change-Id: Ib4a7463c5461180b9145596c3b986123f60a56bd
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoReturn from main after timeout on idle.
Jan Cybulski [Mon, 22 Jun 2015 13:18:55 +0000 (15:18 +0200)]
Return from main after timeout on idle.

Change-Id: Ic50f4f6e1c7edf7e7814f42fb2b054bc9f76e90e
Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
9 years agoAdd API for usb direct access granting
Krzysztof Opasiak [Mon, 29 Jun 2015 14:18:51 +0000 (16:18 +0200)]
Add API for usb direct access granting

Add new service for USB dev files access control

Change-Id: If7d19d5e62c6aba6c81bd132a182e5ad4e768c3b
Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoAdd discoreving of device identity
Krzysztof Opasiak [Fri, 26 Jun 2015 07:49:48 +0000 (09:49 +0200)]
Add discoreving of device identity

because we need to distinguish USB device we use device descriptor
(idVendor, idProduct etc.) to create device ID. When checking if
we should grant access we check if selected device node
belengs to this device.

Change-Id: Ifad14d3e62c6aba6c91bd132a112e5ad4e768c3b
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
9 years agoAdd USB securty daemon (USD) implementation
Jan Cybulski [Tue, 23 Jun 2015 09:22:20 +0000 (11:22 +0200)]
Add USB securty daemon (USD) implementation

This commit is mostly code dump from security-server upstream repository.
Some changes were made like:
-change project name to USD
-remove unnecassary files, rename files accordingly to new project name
-packaging and cmakes adjusting

Change-Id: I94de02983ce171508ade2ec126465cb6ccf4a9dc
Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
9 years agoadd packaging
Stanislaw Wadas [Thu, 21 May 2015 15:40:31 +0000 (17:40 +0200)]
add packaging

add spec and manifest file

Change-Id: Ib6dd8d788ff23c592f6c22109c124e6898694933
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agoadd doxygen doc generator config files
Stanislaw Wadas [Thu, 21 May 2015 15:39:25 +0000 (17:39 +0200)]
add doxygen doc generator config files

Change-Id: I94589e8e28b0c993d7f0454770878e217514c169
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agoadd CMAKE files
Stanislaw Wadas [Thu, 21 May 2015 15:38:36 +0000 (17:38 +0200)]
add CMAKE files

Change-Id: I0eefd1ea11ee4277e4db0dce917f19f7ea1dc98f
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
9 years agoadd simple USB host CAPI
Stanislaw Wadas [Wed, 27 May 2015 13:17:24 +0000 (15:17 +0200)]
add simple USB host CAPI

Change-Id: I864a9625c1f45d9331e751f8c15a0a79bcc573af
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
10 years agoadd skeleton files
Stanislaw Wadas [Thu, 21 May 2015 15:34:12 +0000 (17:34 +0200)]
add skeleton files

add stub src files
add .gitignore file
add LICENSE file
add README file
add ChangeLog file
add AUTHORS file

Change-Id: I89289777e11bd147574d5dacc0fde7b3c4a8048e
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
10 years agoInitial empty repository
KyungMi Lee [Mon, 18 May 2015 06:55:46 +0000 (15:55 +0900)]
Initial empty repository