Commit graph

68 commits

Author SHA1 Message Date
Reto Schneider 7eabab2f5d samples, tests: Use semi-accurate project names
When using an IDE (e.g. Eclipse, Qt Creator), the project name gets
displayed. This greatly simplifies the navigation between projects when
having many of them open at the same time. Naming every project "NONE"
defeats this functionality.

This patch tries to use sensible project names while not duplicating
too much of what is already represented in the path. This is done by
using the name of the directory the relevant CMakeLists.txt file is
stored in. To ensure unique project names in the samples (and again, in
the tests folder) folder, small manual adjustments have been done.

Signed-off-by: Reto Schneider <code@reto-schneider.ch>
2018-10-27 21:31:25 -04:00
Andrei Emeltchenko 47be332b79 samples: hid: Use new logger
Use new USB logger with function names.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-10-10 09:21:55 -04:00
Andrei Emeltchenko 1eb6a01723 usb: Use const for status_callback parameter
usb_dc_status_callback() parameters are interface or configuration
numbers and should be const.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-10-10 09:21:55 -04:00
Andrei Emeltchenko 24b5775fd1 samples: hid: Use delayed work for report send
Delegate report sending to delayed work.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-10-10 09:21:55 -04:00
Andrei Emeltchenko 245b267f1a samples: hid: Make callbacks static
Make callbacks static according to standards.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-10-10 09:21:55 -04:00
Andrei Emeltchenko 61349e3157 samples: hid: Add README for the sample
Describe building and testing of the sample.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-10-10 09:21:55 -04:00
Andrei Emeltchenko 9047e8eec0 samples: hid: Refactor basic HID sample
Refactor USB writes, start transfer only when device
is configured, the change makes it possible to work with native_posix
USB virtual controller.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-10-10 09:21:55 -04:00
Yannis Damigos d1a655a624 subsys/usb: Move to new logger subsystem
Move to new logger subsystem.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-10-08 12:54:57 -04:00
Yannis Damigos 1674d061b6 drivers: usb: device: Migrate to new logger
Move to new logger subsystem.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-10-08 12:54:57 -04:00
Sebastian Bøe 55ee53ce91 cmake: Prepend 'cmake_minimum_required()' into 'app' build scripts
Prepend the text 'cmake_minimum_required(VERSION 3.8.2)' into the
application and test build scripts.

Modern versions of CMake will spam users with a deprecation warning
when the toplevel CMakeLists.txt does not specify a CMake
version. This is documented in bug #8355.

To resolve this we include a cmake_minimum_required() line into the
toplevel build scripts. Additionally, cmake_minimum_required is
invoked from within boilerplate.cmake. The highest version will be
enforced.

This patch allows us to afterwards change CMake policy CMP000 from OLD
to NEW which in turn finally rids us of the verbose warning.

The extra boilerplate is considered more acceptable than the verbosity
of the CMP0000 policy.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-08-15 04:06:50 -07:00
Johann Fischer 085a8b75c5 usb: hid: fix write to interrupt IN endpoint
A HID application can no longer write to the default
interrupt IN endpoint because the addresses are assigned
dynamically. Add hid_int_ep_write() function  and leave
it to the hid-core to call the usb_write() with the correct
endpoint address.

fixes: #8424

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-06-16 11:46:56 +02:00
Andrei Emeltchenko 842ab93f6e usb: Add multifunction composite build test
Add multifunction composite test for building USB device with HID and
MSC functions.

Fixes: #2613

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-04-03 15:58:33 -04:00
Andrei Emeltchenko 0a39c15839 usb: sample: Add support for composite configuration for HID
The current problem with HID is that we need to "patch" static
descriptor table with the size of report descriptor defined in the
user application.

The proposed solution is to have composite_pre_init() defined with
priority CONFIG_KERNEL_INIT_PRIORITY_DEVICE which should run before
composite_init() defined with priority
CONFIG_APPLICATION_INIT_PRIORITY.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-04-03 15:58:33 -04:00
Andrei Emeltchenko 3bf9b05b13 tests: Add USB HID composite test
Test also composite configuration

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-04-03 15:58:33 -04:00
Iván Sánchez Ortega eaaab7771b samples: usb: Make each sample have its own USB product string
Each USB sample, when compiled, will provide a different
USB product string. A "nice to have" feature when trying
out the USB samples (they will show up differently in
`lsusb` or `dmesg`), and also illustrates how to set up
custom USB constants in the config files.

Requires #6589.

Signed-off-by: Iván Sánchez Ortega <ivan@sanchezortega.es>
2018-03-22 12:41:40 +01:00
Michael Hope 4d6d04d3ea hid: change the API table to const.
A minor change to put the API function table into flash.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-03-21 19:45:11 -04:00
Andrei Emeltchenko f3653b1a5c usb: Add sanitycheck configuration
Add configuration for sanitycheck for HID sample

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-01-31 07:42:19 -05:00
Andrei Emeltchenko bab250a0e8 usb: samples: Add HID sample
Add simple USB HID sample device. Connecting to Linux registers as
input device, lsusb is able to show descriptors (unbinded from input)

...
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      32
          Report Descriptor: (length is 32)
            Item(Global): Usage Page, data= [ 0x01 ] 1
                            Generic Desktop Controls
            Item(Local ): Usage, data= [ 0x00 ] 0
                            Undefined
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Report ID, data= [ 0x01 ] 1
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Local ): Usage, data= [ 0x00 ] 0
                            Undefined
            Item(Main  ): Input, data= [ 0x82 ] 130
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Volatile
Bitfield
            Item(Global): Report ID, data= [ 0x02 ] 2
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Local ): Usage, data= [ 0x00 ] 0
                            Undefined
            Item(Main  ): Output, data= [ 0x82 ] 130
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Volatile
Bitfield
            Item(Main  ): End Collection, data=none
...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-01-31 07:42:19 -05:00