platform/core/api/usb-host.git
4 years agoFix typo 57/258057/1 accepted/tizen_4.0_unified tizen_4.0 accepted/tizen/4.0/unified/20210511.210834 submit/tizen_4.0/20210510.042249 submit/tizen_4.0/20210510.044032 submit/tizen_4.0/20210510.045744 submit/tizen_4.0/20210510.074538 submit/tizen_4.0/20210510.102510 submit/tizen_4.0/20210510.235200
taemin.yeom [Mon, 10 May 2021 03:57:09 +0000 (12:57 +0900)]
Fix typo

Change-Id: Ief47788df629d84c69cbbe8a0ae038aa1690be8a
Signed-off-by: taemin.yeom <taemin.yeom@samsung.com>
4 years agoFix race condition between usb_host_destroy and fd_removed_cb #2 24/255924/1 accepted/tizen/4.0/unified/20210330.064429 submit/tizen_4.0/20210325.070233 submit/tizen_4.0/20210329.052501 submit/tizen_4.0/20210330.002654
INSUN PYO [Thu, 25 Mar 2021 05:02:31 +0000 (14:02 +0900)]
Fix race condition between usb_host_destroy and fd_removed_cb #2

Add missing code when cherry-picking from 5.0.

0  g_io_channel_unix_get_fd (channel=channel@entry=0x0) at giounix.c:654
1  0xb6fa5f52 in fd_removed_cb (fd=6, user_data=0x2a011f20) at /usr/src/debug/capi-system-usbhost-0.0.1/src/usb_host.c:431
2  0xb6e29baa in usbi_io_exit (ctx=ctx@entry=0x2a014808) at io.c:1185
3  0xb6e26a8c in libusb_exit (ctx=0x2a014808) at core.c:2232
4  0xb6fa6b04 in usb_host_destroy (context=0x2a011f20) at /usr/src/debug/capi-system-usbhost-0.0.1/src/usb_host.c:547
5  0x2a00079a in main () at /usr/src/debug/session-utils-0.1/src/usb-host-test/usb-host-test.c:43

Change-Id: I9639c52e512834422fb2ede785363a28d2a4525e

4 years agoFix race condition between usb_host_destroy and fd_removed_cb 81/255681/1 submit/tizen_4.0/20210323.003838
INSUN PYO [Tue, 11 Sep 2018 04:27:06 +0000 (13:27 +0900)]
Fix race condition between usb_host_destroy and fd_removed_cb

fd_removed_cb is called by libusb_exit() -> usbi_io_exit() -> usbi_remove_poolfd() -> ctx->fd_removed_cb.

fd_removed_cb uses context->gio_channels and context->channel_list_lock.
So, you should not free and destroy it before calling libusb_exit().

Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: I5fdde607d19be9e4df9214489f91e3d33f41eaf6

5 years agoChange "developer.tizen.org" link to "docs.tizen.org" 79/220079/1
Yunmi Ha [Fri, 13 Dec 2019 02:14:37 +0000 (11:14 +0900)]
Change "developer.tizen.org" link to "docs.tizen.org"

Change-Id: I905d2ed3a03f4fda90908b5cabff4e293681052b
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
7 years agoFix typing error 23/171523/1 accepted/tizen/4.0/unified/20180306.173612 submit/tizen_4.0/20180306.055632
lokilee73 [Mon, 5 Mar 2018 09:07:18 +0000 (18:07 +0900)]
Fix typing error

Change-Id: I5e0e504fa16f2ec4a96ded900d89b2666bdd3716
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
7 years agoMerge "Check if device is opened in getting active configuration" into tizen_4.0
Chang Joo Lee [Fri, 22 Dec 2017 07:48:44 +0000 (07:48 +0000)]
Merge "Check if device is opened in getting active configuration" into tizen_4.0

7 years agoCheck if device is opened in getting active configuration 72/164472/1 accepted/tizen/4.0/unified/20171219.183848 submit/tizen_4.0/20171219.084427 tizen_4.0.IoT.p2_release
lokilee73 [Tue, 19 Dec 2017 08:01:43 +0000 (17:01 +0900)]
Check if device is opened in getting active configuration

Change-Id: Ifca3566ea75186363b98eb219cf5f1c04190a209

7 years agoCheck if device is opened in getting active configuration 95/159695/1
Paweł Szewczyk [Fri, 3 Nov 2017 09:37:46 +0000 (10:37 +0100)]
Check if device is opened in getting active configuration

Change-Id: Ice65b6724f57d96b9af01c656a3df509a864b958
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoapi: Add altsetting getter 33/147633/1 accepted/tizen/4.0/unified/20170905.175359 submit/tizen_4.0/20170905.071639 tizen_4.0.IoT.p1_release tizen_4.0.m2_release
lokilee73 [Tue, 5 Sep 2017 07:12:37 +0000 (16:12 +0900)]
api: Add altsetting getter

Change-Id: I55de3d0aa3f7963ae29277b05e4d9a16e1dee582
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
7 years agoapi: Add API for unconfiguring devices 32/147632/1
lokilee73 [Tue, 5 Sep 2017 07:09:52 +0000 (16:09 +0900)]
api: Add API for unconfiguring devices

Change-Id: Ifca8048c37708f331f94e2667350704c61113860
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
8 years agoFix blocking libusb event handling 85/129685/1 accepted/tizen/4.0/unified/20170816.012733 accepted/tizen/4.0/unified/20170828.223858 accepted/tizen/unified/20170605.151631 submit/tizen/20170605.090941 submit/tizen_4.0/20170811.094300 submit/tizen_4.0/20170828.100002
Paweł Szewczyk [Wed, 17 May 2017 13:01:13 +0000 (15:01 +0200)]
Fix blocking libusb event handling

This patch changes libusb_handle_events to
libusb_handle_events_timeout_completed, which is non-blocking and does
not cause applications to hang.

Change-Id: Ieebfcab3ae827b158345e09c41d6c136a7ed0e18
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
8 years agoMerge "[4.0] [RFC] api: Add connected/disconnected events handling" into tizen accepted/tizen/unified/20170413.150547 submit/tizen/20170412.154456 tizen_4.0.m1_release
Karol Lewandowski [Wed, 12 Apr 2017 10:04:42 +0000 (03:04 -0700)]
Merge "[4.0] [RFC] api: Add connected/disconnected events handling" into tizen

8 years ago[4.0] [RFC] api: Add connected/disconnected events handling 72/113172/9
Paweł Szewczyk [Mon, 27 Mar 2017 10:03:40 +0000 (12:03 +0200)]
[4.0] [RFC] api: Add connected/disconnected events handling

Change-Id: If8a58e8401f6913956a5a1d88d5719a75aed2d0b
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
8 years agoURL : apply changed URL for the document 33/123533/1 accepted/tizen/unified/20170406.173256 submit/tizen/20170406.043409
lokilee73 [Thu, 6 Apr 2017 04:29:54 +0000 (13:29 +0900)]
URL : apply changed URL for the document

Change-Id: Ibdc923ae567f00044c1c7ab3ca513863ebf1d24d
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
8 years agoRestore correct coding style in usb_host.c 73/104173/5
Paweł Szewczyk [Mon, 12 Dec 2016 12:54:17 +0000 (13:54 +0100)]
Restore correct coding style in usb_host.c

This commit corrects the coding style errors introduced in
commit 0da04f8ec63350ac875247f1b97b9147ba852db7.
The space before the label colon is actually prohibited and detected
by checkpatch script.

Change-Id: I707d2e9a6e40cdc27dfd684c923a2deed59fd923
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
8 years agoMerge branch 'tizen_3.0' into tizen 14/107614/1 accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen/common/20161229.140140 accepted/tizen/ivi/20161229.233202 accepted/tizen/mobile/20161229.233059 accepted/tizen/tv/20161229.233124 accepted/tizen/unified/20170309.031858 submit/tizen/20161229.040631 submit/tizen_unified/20170308.100405
taeyoung [Thu, 29 Dec 2016 01:54:46 +0000 (10:54 +0900)]
Merge branch 'tizen_3.0' into tizen

Signed-off-by: taeyoung <ty317.kim@samsung.com>
Change-Id: Ieb3ab4c6c8b4cfd251933507d80f9d16dc0970cb

8 years agoApply Tizen coding rule 90/103590/1 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv tizen_3.0.m2 tizen_3.0_tv accepted/tizen/3.0.m2/mobile/20170104.122001 accepted/tizen/3.0.m2/tv/20170104.122333 accepted/tizen/3.0/common/20161212.060616 accepted/tizen/3.0/ivi/20161212.023906 accepted/tizen/3.0/mobile/20161212.023816 accepted/tizen/3.0/tv/20161212.023833 submit/tizen_3.0.m2/20170104.093749 submit/tizen_3.0/20161209.130513
pr.jung [Fri, 9 Dec 2016 01:35:51 +0000 (10:35 +0900)]
Apply Tizen coding rule

Change-Id: I548833719dc6748049be232b47b45111e02678ba
Signed-off-by: pr.jung <pr.jung@samsung.com>
8 years agofix not to change the output parameter when an error occurs 65/100965/1 accepted/tizen/3.0/common/20161201.135137 accepted/tizen/3.0/ivi/20161201.031525 accepted/tizen/3.0/mobile/20161201.031402 accepted/tizen/3.0/tv/20161201.031438 submit/tizen_3.0/20161130.101437
taeyoung [Wed, 30 Nov 2016 04:18:20 +0000 (13:18 +0900)]
fix not to change the output parameter when an error occurs

Change-Id: Ic809be983c09a80a07103b5b1c5554cc48e48aba
Signed-off-by: taeyoung <ty317.kim@samsung.com>
8 years agoFix API reference warning - several fixes 58/99858/1 accepted/tizen/3.0/common/20161129.103434 accepted/tizen/3.0/ivi/20161129.002439 accepted/tizen/3.0/mobile/20161129.002344 accepted/tizen/3.0/tv/20161129.002403 submit/tizen_3.0/20161128.140207
Kunhoon Baik [Thu, 24 Nov 2016 09:08:43 +0000 (18:08 +0900)]
Fix API reference warning - several fixes

Change-Id: I6b68af3d69c620bd6f0b8081e216a2882912f7ef

8 years agocoverage: remove system error logs from the coverage test 78/89878/1 accepted/tizen/3.0/common/20161114.105339 accepted/tizen/3.0/ivi/20161011.053453 accepted/tizen/3.0/mobile/20161015.032624 accepted/tizen/3.0/tv/20161016.004126 accepted/tizen/common/20161021.194020 accepted/tizen/ivi/20160929.001655 accepted/tizen/mobile/20160929.001515 accepted/tizen/tv/20160929.001709 submit/tizen/20160927.110043 submit/tizen_3.0_common/20161104.104000 submit/tizen_3.0_ivi/20161010.000000 submit/tizen_3.0_ivi/20161010.000010 submit/tizen_3.0_mobile/20161015.000001 submit/tizen_3.0_tv/20161015.000001 submit/tizen_common/20161021.175024
taeyoung [Tue, 27 Sep 2016 09:12:42 +0000 (18:12 +0900)]
coverage: remove system error logs from the coverage test

Change-Id: I14884b4715e110e6e1c6ad2f3d51273469ad431e
Signed-off-by: taeyoung <ty317.kim@samsung.com>
8 years agoremove TIZEN_ERROR_USB_HOST 64/87964/1 accepted/tizen/common/20160913.170306 accepted/tizen/ivi/20160913.042312 accepted/tizen/mobile/20160913.042240 accepted/tizen/tv/20160913.042255 submit/tizen/20160913.011724
taeyoung [Mon, 12 Sep 2016 10:23:40 +0000 (19:23 +0900)]
remove TIZEN_ERROR_USB_HOST

TIZEN_ERROR_USB_HOST is defined in capi-base-common.
Thus it needs to be remove from the usb-host.h

Change-Id: I008bd3f2b4c5b9e8b54d3209468406027b398a98
Signed-off-by: taeyoung <ty317.kim@samsung.com>
8 years agoremove usb_host_device_get_string_descriptor_ascii() from the api list 58/87958/1
taeyoung [Mon, 12 Sep 2016 09:10:09 +0000 (18:10 +0900)]
remove usb_host_device_get_string_descriptor_ascii() from the api list

it can be replaced to usb_host_device_get_serial_number_str(),
usb_host_device_get_product_str(), usb_host_device_get_manufacturer_str().

Change-Id: I4bf8fd54eb3138e11e72b0ff65a56ee107356700
Signed-off-by: taeyoung <ty317.kim@samsung.com>
8 years agoapi: Fix documentation and spelling 76/87176/3
Paweł Szewczyk [Tue, 6 Sep 2016 16:33:10 +0000 (18:33 +0200)]
api: Fix documentation and spelling

Change-Id: I9402bb3d6c43874b32621e84920d3a50400a0a67
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
8 years agofeature: add feature check routine 79/86879/1
taeyoung [Mon, 5 Sep 2016 10:27:11 +0000 (19:27 +0900)]
feature: add feature check routine

- "http://tizen.org/feature/usb.host" feature is required
  to use usb host apis. Thus the feature check routine is added.

Change-Id: I291bc5bfc67c8348d48edea8738c349237057a06
Signed-off-by: taeyoung <ty317.kim@samsung.com>
8 years agocommon: remove unused codes 54/86554/1 submit/tizen/20160905.095524
taeyoung [Fri, 2 Sep 2016 01:02:12 +0000 (10:02 +0900)]
common: remove unused codes

- test dir, example dir: they are not included to image.
     Thus they need to be removed
- others: Unused codes should be removed

Change-Id: I7518ec23f6e64b268a6811e758761ac23ae6baa0
Signed-off-by: taeyoung <ty317.kim@samsung.com>
8 years agoapi: Switch to Tizen Native API conventions 95/64795/42
Paweł Szewczyk [Thu, 7 Apr 2016 13:55:29 +0000 (15:55 +0200)]
api: Switch to Tizen Native API conventions

Change-Id: I41fa22da669864b161f4d6ac8baed19d9f1916dd
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
9 years agotests: Add tests of asynchronous API 17/62117/1
Paweł Szewczyk [Thu, 10 Mar 2016 11:06:37 +0000 (12:06 +0100)]
tests: Add tests of asynchronous API

Change-Id: Ia090f9817c222df4c88f5dcebc81982ff7ee7679
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
9 years agolibhusb: Add async transfer API 06/61406/4
Paweł Szewczyk [Mon, 7 Mar 2016 14:23:23 +0000 (15:23 +0100)]
libhusb: Add async transfer API

Change-Id: Ia1a09dfaa32e6f420eb64f3df22825e9f6349e6d
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
9 years agousd: Remove USD 61/61061/2 submit/tizen_common/20160317.155115
Paweł Szewczyk [Tue, 1 Mar 2016 15:30:11 +0000 (16:30 +0100)]
usd: Remove USD

USD functionality is moved to deviced. This code is no longer needed.

Change-Id: Iec6f46134df8070d7dafb89b19eff5571e872605
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
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 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 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: 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: 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: 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 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 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>