Commit graph

79 commits

Author SHA1 Message Date
Marek Pieta f6600040e4 usb: cdc_acm: Update log level only if UART log backend is enabled
Change updates log level only if UART log backend is enabled in Kconfig
configuration. The log level update is not needed in case logs are
provided over other backend (e.g. RTT).

Change affects both USB stacks.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2024-06-21 08:45:22 -04:00
Johann Fischer ed8c99977f usb: device: allow uneven SN to be obtained from HWINFO
If the length of the string literal reserved for the serial number
descriptor is odd, the string is not used because its length is always
even and therefore one character longer. Fix this by using the shortest
length for the copy.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-06-12 14:31:11 +03:00
Jordan Yates 924db97724 usb: cdc_acm: add locks around ring_buf_put
The ring buffer API is explicitly not thread safe, with users needing to
implement their own locking. As `poll_out` and `fifo_fill` are operating
on the same ringbuffer, these locks are needed.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-03 03:44:45 -07:00
Tomasz Moń d034106b40 usb: device: cdc_acm: Warn once about full ring buffer
Generating separate log entry at INFO level for every single character
dropped is excessive and leads to log flood. Logging dropped character
in no way helps end user and is really a delayed performance killer that
triggers when CDC ACM buffer gets full.

If user does not want to lose outgoing characters then the solution is
to enable hardware flow control which properly blocks in the case the
output buffer is full.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-05-28 18:58:55 +02:00
Alexander Kozhinov bf77d74e91 usb: device: usb_descriptor.c
fix cbprintf_package warning.
cbprintf_package complains about char usage for %p
string argument and suggests void * usage.

Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
2024-05-28 18:57:22 +02:00
Aurelien Jarno 44f86dd67d usb: dfu: fix detach happening too fast
In some relatively rare conditions, the DFU detach/attach happens to
fast, which cause the host to not notice it. It seems to to be the case
for instance on STM32 when no endpoint are being used.

Adding a 1 ms delay (i.e. one SOF period) between the detach and the
attach fixes the issue.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2024-05-24 07:48:03 -04:00
Johann Fischer 29003ff264 usb: bos: cleanup Binary Device Object Store header
We could reuse the BOS header, but there are parts that are only needed
in the legacy device support or used internally and the tests. Move this
parts to the appropriate places.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 16:25:02 +01:00
Johann Fischer 3eec2a56d5 usb: device: get rid of the partial initialization called by SYS_INIT
Part of the initialization is done in the static usb_device_init()
function called by SYS_INIT(). We can move part of it, which initialize
the descriptor and calls usb_set_config(), to usb_enable(). This allow
some usb_get_device_descriptor() dependencies called at application
desired point.

Also make sure that usb_fix_descriptor() is called only once.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-08 12:00:46 +02:00
Tomasz Moń 2f24adbe0f usb: device: Do not claim to be USB 3.2 device
The bcdUSB value 0x0210 defined in USB 3.2 Specification indicates USB
3.2 device operating in one of the USB 2.0 modes. USB 2.0 Link Power
Management Addendum defines bcdUSB value 0x0201 to indicate that USB 2.0
device supports the request to read the BOS Descriptor.

The main difference between bcdUSB 0x0210 and 0x0201 is that the USB 3.2
device must support LPM, while USB 2.0 devices can (but are not required
to) support LPM.

The difference is respected by USB 3 Gen X Command Verifier (2.3.0.0)
Chapter 9 Tests [USB 2 devices], where the test behaves as follows:
  * For bcdUSB 0x0200:
      Checking Device Under Test for LPM L1 Compatibility...
      USB version of device is 2.00.
      DUT is NOT compatible with LPM.
      LPM is NOT required for DUT
      LPM is only supported in USB version 2.01 and above.

  * For bcdUSB 0x0201:
      Checking Device Under Test for LPM L1 Compatibility...
      USB version of device is 2.01.
      DUT IS compatible with LPM.
      LPM is NOT required for DUT
      USB 2.0 Extension Descriptor bmAttributes:
        LPM Capable = 0
        BESL and Alternate HIRD Supported = 0
        Baseline BESL Valid = 0
        Deep BESL Valid = 0
        Baseline BESL: 0d
        Deep BESL:  0d
      LPM is not supported

  * For bcdUSB 0x0210:
      Checking Device Under Test for LPM L1 Compatibility...
      USB version of device is 2.10.
      DUT IS compatible with LPM.
      LPM IS required for DUT
      USB 2.0 Extension Descriptor bmAttributes:
        LPM Capable = 0
        BESL and Alternate HIRD Supported = 0
        Baseline BESL Valid = 0
        Deep BESL Valid = 0
        Baseline BESL: 0d
        Deep BESL:  0d
      (USB: 9.6.2.1.6) Bit 1 in Attributes field of a USB 2.0 Extension
      descriptor returned in response to a GetDescriptor(BOS) request
      must be 1 for LS/FS/HS devices that support LPM L1.

The test fails when LPM bit is not set in USB 2.0 Extension Descriptor
only when bcdUSB is 0x0210. The test failure was incorrectly fixed in
commit 312429be3c ("usb: samples: Add Extension descriptor to webUSB
sample."). Properly fix the issue by changing bcdUSB to 0x0201 and
removing the false LPM support claim.

The false LPM claim was leading to device ceasing to work after some
time if there was no traffic from host to device (when the host is
likely to have executed the LPM L1 transition that was not properly
handled by the device).

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-05-06 14:54:23 +01:00
Roman Studenikin 260fc89643 drivers: use DT_INST_PROP over DT_INST_PROP_OR if possible
It might happens that DT(_INST)_PROP_OR is used with boolean properties.
For instance:

	.single_wire = DT_INST_PROP_OR(index, single_wire, false),	\
	.tx_rx_swap = DT_INST_PROP_OR(index, tx_rx_swap, false),	\

This is not required as boolean properties are generated with false
value when not present, so the _OR macro extension is superflous
and the above code can be replaced by:

	.single_wire = DT_INST_PROP(index, single_wire),		\
	.tx_rx_swap = DT_INST_PROP(index, tx_rx_swap),			\

Signed-off-by: Roman Studenikin <srv@meta.com>
2024-01-30 00:26:58 +00:00
James Zipperer 273165c3bb usb: device: audio: fix compiler warning for usb audio microphone
audio_receive_cb is only used by headphones and headset, it is unused in
microphone-only configurations.  Gate compilation based on the device
tree.

Signed-off-by: James Zipperer <jzipperer@fb.com>
2024-01-10 15:08:06 +01:00
James Zipperer 975208209b usb: device: audio options for polling-interval and sample-rate-hz
These descriptor values can now be configured via the device tree

Signed-off-by: James Zipperer <jzipperer@fb.com>
2024-01-10 15:08:06 +01:00
Tomasz Moń f12e1d75ed usb: device: cdc_acm: Always buffer poll out data if possible
Queue characters in TX ring buffer regardless of interface state. This
allows simple applications that print basic output to CDC ACM port to
not care about connection or DTR state. Note that depending on actual
application requirements it might be still wise to wait for DTR before
trying to send data.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-13 09:43:46 +01:00
Tomasz Moń 0127d000a2 usb: device: cdc_acm: Use ZLP to detect initial host read
Prevent ECHO on Linux by arming IN endpoint with ZLP when interface is
configured and making sure that actual payload is only sent after
initialization timeout. The ZLP is not visible to host side applications
because the applications are really accessing tty buffer and received
ZLP does not modify tty buffer in any way.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-13 09:43:46 +01:00
Tomasz Moń 8db6919695 nrfx_usbd: Rename to nrf_usbd_common
Rename local usbd copy from nrfx_usbd to nrf_usbd_common and use it in
both USB stacks. Renaming header to nrf_usbd_common.h allows breaking
changes in exposed interface. Mark all doxygen comments as internal
because local usbd copy should not be treated as public interface
because we are under refactoring process that aims to arrive at native
driver and therefore drop nrf_usbd_common in the future.

Use Zephyr constructs directly instead of nrfx glue macros.

No functional changes.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-07 14:06:51 +01:00
Benedikt Schmidt be8408cbac usb: fix thread function signatures
Fix thread function signatures to avoid stack corruption on thread exit.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-10-30 12:24:34 +01:00
Tomasz Moń 08bd1c5ec2 usb: device: Fix ZLP write race condition
ZLP packet has to be read and acknowledged by host just like any other
DATA packet. Do not end transfer until the host actually acknowledged
the trailing ZLP. This fixes the race condition between host and Zephyr
application where the next transfer could be lost if host did not issue
IN token (that would read read ZLP) before the application tried to
start new transfer.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-10-26 13:52:31 +02:00
Johann Fischer c152e0980c usb: device: cdc_acm: block in uart_poll_out() routine
According to the UART API documentation, implementation must block when
the transceiver is full. For CDC ACM UART, TX ringbuffer can be
considered as transceiver buffer/FIFO. Blocking when the USB subsystem
is not ready is considered highly undesirable behavior. Blocking may
also be undesirable when CDC ACM UART is used as a logging backend.

Change the behavior of CDC ACM poll out to:
 - Block if the TX ring buffer is full, hw_flow_control property is
   enabled, and called from a non-ISR context.
 - Do not block if the USB subsystem is not ready, poll out
   implementation is called from an ISR context, or hw_flow_control
   property is disabled.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-10-23 11:48:44 +02:00
Johann Fischer 9112c7e0ff usb: device: cdc_acm: restart OUT transfer in only configured state
When a usb_transfer is cancelled, the callback is finally invoked.
Silly, there is no transfer status passed, and in the callback we can
only check the size and device status.

Reported-by: Alex Kaiser
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-10-23 11:48:44 +02:00
Alexander Kaiser 078cec1e1f usb: msc: Added check for negative overflow length
Added a check for when current_offset plus size is less than BLOCK_SIZE.

Signed-off-by: Alexander Kaiser <akaiser@urbansky.com>
2023-10-20 15:00:57 +02:00
Saw Xu 459f8e3251 usb: device: audio: Support volume control
Makes USB device audio class support volume control feature.

Signed-off-by: Saw Xu <Saw1993@126.com>
2023-09-21 15:04:14 +02:00
Gerard Marull-Paretas e6bef2d3f3 usb: device: class: audio: move to POST_KERNEL
Devices should be initialized in pre/post-Kernel levels.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-15 16:04:19 +02:00
Johann Fischer ad498aa550 usb: device: hid: remove CONFIG_USB_HID_PROTOCOL_CODE
Kconfig option USB_HID_PROTOCOL_CODE, deprecated in v2.6,
is finally removed.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-09-05 16:16:56 +02:00
Ren Chen 6bceb45176 usb: hid: Call the report proto callback function when the reset occurs
This commit changes the protocol callback function is invoked if the HID
protocol changed due to reset.

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2023-09-05 16:15:58 +02:00
Nick Ward 2d65acca3a drivers: gpio: use gpio_is_ready_dt helper function
Update `struct gpio_dt_spec` use with gpio_is_ready_dt()

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-08-28 08:48:35 -05:00
Fabio Baltieri ec71be5d9d drivers,subsys: fix few missing k_work_delayable_from_work
Fix few instances of delayable work handlers using the k_work pointer
directly in a CONTAINER_OF pointing to a k_work_delayable.

This is harmless since the k_work is the first element in
k_work_delayable, but using k_work_delayable_from_work is the right way
of handling it.

Change a couple of explicit CONTAINER_OF doing the same work as the
macro in the process.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-28 10:12:21 +02:00
Alberto Escolar Piedras 9eeb78d86d COVERAGE: Fix COVERAGE_GCOV dependencies
CONFIG_COVERAGE has been incorrectly used to
change other kconfig options (stack sizes, etc)
code defaults, as well as some samples behaviour,
which should not have dependend on it.

Instead those should have depended on COVERAGE_GCOV,
which, being the one which adds special code and
temporary RAM storage for embedded targets,
require changes to many features.

When building for the native targets, all this was
unnecessary.

=> Fix the dependency.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-08-24 15:36:31 +02:00
Tomasz Moń 0ab14d94b8 usb: device: Fix transfer slot leak without callback
Log transfer status and release transfer semaphore regardless if user
provided transfer completion callback or not. This fixes transfer slot
leak when transfer without callback completes.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-08-04 22:54:17 +00:00
Johann Fischer aecb1ca2e7 usb: device: move the content of usb_msc.h to implementation file
The usb_msc.h header does not provide any API. The content is only
used by the MSC implementation for the current USB device stack and
is not required for any use of MSC by the application.
The content has no proper namespace and must not be reused for
anything else in (new) USB support.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-07-28 07:09:48 +02:00
Johann Fischer 7bfec37247 usb: device: clarify the impact of Kconfig option USB_COMPOSITE_DEVICE
Effectively, this option changes code triple in device descriptor.
Although the name is misleading, renaming it would again lead
to negative user experiences. Instead, clarify what the option does
and always select it where it is required.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-07-26 14:37:15 +02:00
Nicolas Pitre d1a50e540b subsys/usb: move to timepoint API
Remove sys_clock_timeout_end_calc() usage.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-07-25 09:12:26 +02:00
Tomasz Moń e47fc45c4d usb: audio: correctly report internal delay
Every USB device must buffer isochronous data for at least 1 frame in
order to remove packet jitter within a frame. USB Specification Revision
2.0 describes necessary buffering in 5.12.5 Data Prebuffering. USB Audio
1.0 specification mentions buffering in 3.4 Inter Channel Synchronization.

Set bDelay to 1 instead of 0, because bDelay 1 is both the minimum
allowed value and matches the actual device behavior.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-07-19 08:27:00 +02:00
Alberto Escolar Piedras 8444343511 usb: device: class: rndis: Fix for 64bit platforms
Instead of assuming pointers are 32bits wide,
cast them to the appropriate pointer arithmetic type.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-06-17 07:36:36 -04:00
Tomasz Moń ae6c856128 usb: device: class: rndis: Limit response length
Prevent potential buffer overflow when encapsulated response is more
than CONFIG_USB_REQUEST_BUFFER_SIZE. Log error and truncate response if
USB control transfer request buffer is not large enough.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-06-13 07:02:49 -04:00
Gerard Marull-Paretas dacb3dbfeb iterable_sections: move to specific header
Until now iterable sections APIs have been part of the toolchain
(common) headers. They are not strictly related to a toolchain, they
just rely on linker providing support for sections. Most files relied on
indirect includes to access the API, now, it is included as needed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-22 10:42:30 +02:00
Flavio Ceolin 942b99a322 usb: audio: kconfig: Fix experimental feature
select EXPERIMENTAL for experimental option.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-05-10 11:41:50 +02:00
Johann Fischer 75ab9f81e3 usb: device: fix control endpoint handling with MPS of 8 bytes
The possible control endpoint MPS for USB 2.0 FS devices is
8, 16, 32, or 64 bytes. Typically, USB2.0 compliant devices support MPS
up to 64 bytes, and we have not had the need to support other MPS.

This patch implements a mechanism to fall back to the minimum allowed
MPS when a controller is likely a USB 1.1 compliant device and does
not support control endpoint MPS of 64 bytes.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-04-21 12:45:57 +02:00
Johann Fischer 0ad1eef4b7 usb: device: Revert "fix possible deadlock in usb_transfer_sync()"
This reverts commit cd7461495f,
introduced to fix possible deadlock as result of changes in
commit f206170c65
("usb: device: Do not call callback when transfer is cancelled")
which is now reverted.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-04-17 11:30:48 +02:00
Nickolas Lapp 81e4934ebd usb: device: Revert "Do not call callback when transfer is cancelled"
This reverts commit f206170c65
introduced as workaround for nRF USBD device controller in PR
https://github.com/zephyrproject-rtos/zephyr/pull/16193.

This commit may be reverted due to changes made in
commit e326c58399
("usb: device: Do not cancel transfers on suspend").

Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-04-17 11:30:48 +02:00
Gerard Marull-Paretas a5fd0d184a init: remove the need for a dummy device pointer in SYS_INIT functions
The init infrastructure, found in `init.h`, is currently used by:

- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices

They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:

```c
struct init_entry {
	int (*init)(const struct device *dev);
	/* only set by DEVICE_*, otherwise NULL */
	const struct device *dev;
}
```

As a result, we end up with such weird/ugly pattern:

```c
static int my_init(const struct device *dev)
{
	/* always NULL! add ARG_UNUSED to avoid compiler warning */
	ARG_UNUSED(dev);
	...
}
```

This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:

```c
static int my_init(void)
{
	...
}
```

This is achieved using a union:

```c
union init_function {
	/* for SYS_INIT, used when init_entry.dev == NULL */
	int (*sys)(void);
	/* for DEVICE*, used when init_entry.dev != NULL */
	int (*dev)(const struct device *dev);
};

struct init_entry {
	/* stores init function (either for SYS_INIT or DEVICE*)
	union init_function init_fn;
	/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
	 * to know which union entry to call.
	 */
	const struct device *dev;
}
```

This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.

**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

init: convert SYS_INIT functions to the new signature

Conversion scripted using scripts/utils/migrate_sys_init.py.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

manifest: update projects for SYS_INIT changes

Update modules with updated SYS_INIT calls:

- hal_ti
- lvgl
- sof
- TraceRecorderSource

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: devicetree: devices: adjust test

Adjust test according to the recently introduced SYS_INIT
infrastructure.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: kernel: threads: adjust SYS_INIT call

Adjust to the new signature: int (*init_fn)(void);

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 14:28:07 +00:00
JP Sugarbroad 6d4266a451 usb: device: msc: support larger devices
Track LBA rather than byte offset in order to simplify the code and
support devices larger than 4GiB.

Signed-off-by: JP Sugarbroad <jpsugar@amazon.com>
2023-03-02 13:51:37 +01:00
Miika Karanki 549de77750 usb: device: fix k_usleep in isr in set_endpoint
set_device can be called in interrupt context at least with
stm32u5 soc. Calling k_usleep from there causes the isr
to run forever.

Signed-off-by: Miika Karanki <miika.karanki@vaisala.com>
2023-02-27 11:34:33 +01:00
Zachary J. Fields 66aff25396 usb: usb_transfer.c: Address -Wextra warnings
Changed incrementing `for` loop counters to `size_t` from `int` to
eliminate warning, "warning: comparison of integer expressions of
different signedness: 'uint32_t' {aka 'unsigned int'} and 'int'
[-Wsign-compare]"

Signed-off-by: Zachary J. Fields <zachary_fields@yahoo.com>
2023-02-24 09:39:01 +01:00
Georgij Cernysiov d7cf297d98 usb: device: class: rndis: remove CDC descriptors
RNDIS is not a CDC class.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-02-11 08:19:32 +09:00
Georgij Cernysiov 3055a8326d usb: device: class: rndis: correct IAD and IF0 descriptors
Use descriptors as dictated by Microsoft and USB-IF.
That allows the RNDIS device to be correctly detected on Windows.

* Microsoft: https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/supported-usb-classes
* USB-IF Defined Class Codes: https://www.usb.org/defined-class-codes

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-02-11 08:19:32 +09:00
Georgij Cernysiov fd1f28efb6 usb: device: class: rndis: correct packet reception
Allows receive packets that are bigger than
CONFIG_RNDIS_BULK_EP_MPS.

Considering:
* MaxPacketsPerTransfer is 1
* MaxTransferSize is 1558
* PacketAlignmentFactor is 0 (20=1)

The rndis_bulk_out shall be able to receive transfer
up to 1558 bytes (inclusive).

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-02-10 15:34:05 +01:00
Tomasz Moń e326c58399 usb: device: Do not cancel transfers on suspend
Cancelling transfers on suspend contradicts Universal Serial Bus
Specification Revision 2.0, 9.1.1.6 Suspended:
  * When suspended, the USB device maintains any internal status,
    including its address and configuration.

The internal status definitely includes any pending USB transfers.
If there is a class that wants to cancel transfer on suspend, then the
cancel should be initiated by the class, not the device stack itself.

Update hal_nordic to a version that does not abort all endpoints at
suspend. It seems that aborting endpoints on suspend in nrfx driver was
the actual reason why transfers were canceled on suspend.

Remove transfer retriggering on resume from CDC ACM and Bluetooth class
implementations because transfers are no longer cancelled on suspend.
Other classes do not have any suspend related workarounds implemented.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-01-18 11:48:13 +01:00
Johann Fischer 7a90b221a5 usb: device: bluetooth: remove USB_TRANS_NO_ZLP for OUT transfers
USB_TRANS_NO_ZLP flag has no meaning for usb_transfer() in
host-to-device direction (USB_TRANS_READ).

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-10 10:30:46 +01:00
Tomasz Moń 73e3fcabc0 usb: dfu: Schedule timer handler from USB workqueue
Use k_work_delayable instead of k_timer in order to execute timeout in
USB workqueue context instead of ISR context. This fixes Will-Detach on
targets where usb_dc_detach() uses functions not allowed in ISR context,
e.g. nrfx usb_dc_detach() acquires mutex.

Fixes: c27d48c89a ("usb: dfu: Support DFU with WinUSB on Windows")

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-01-04 10:33:35 +01:00
Ryan McClelland 34cfba73b4 usb: device: hid: correct bcdHID to v1.11 spec
bcdHID is intended for the spec version of USB HID. It was pointing to the
v1.1 bcdUSB define which happens to be the same value for the v1.10 hid
spec version. This corrects it to use the v1.11 HID spec.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2022-12-21 12:20:55 +01:00