zephyr/subsys/usb/class/hid/Kconfig
Ulf Magnusson eddd98f811 kconfig: Replace some single-symbol 'if's with 'depends on'
I think people might be reading differences into 'if' and 'depends on'
that aren't there, like maybe 'if' being needed to "hide" a symbol,
while 'depends on' just adds a dependency.

There are no differences between 'if' and 'depends on'. 'if' is just a
shorthand for 'depends on'. They work the same when it comes to creating
implicit menus too.

The way symbols get "hidden" is through their dependencies not being
satisfied ('if'/'depends on' get copied up as a dependency on the
prompt).

Since 'if' and 'depends on' are the same, an 'if' with just a single
symbol in it can be replaced with a 'depends on'. IMO, it's best to
avoid 'if' there as a style choice too, because it confuses people into
thinking there's deep Kconfig magic going on that requires 'if'.

Going for 'depends on' can also remove some nested 'if's, which
generates nicer symbol information and docs, because nested 'if's really
are so simple/dumb that they just add the dependencies from both 'if's
to all symbols within.

Replace a bunch of single-symbol 'if's with 'depends on' to despam the
Kconfig files a bit and make it clearer how things work. Also do some
other minor related dependency refactoring.

The replacement isn't complete. Will fix up the rest later. Splitting it
a bit to make it more manageable.

(Everything above is true for choices, menus, and comments as well.)

Detected by tweaking the Kconfiglib parsing code. It's impossible to
detect after parsing, because 'if' turns into 'depends on'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-08 08:32:42 -05:00

76 lines
1.9 KiB
Plaintext

# USB HID configuration options
# Copyright (c) 2018 Intel Corp.
# SPDX-License-Identifier: Apache-2.0
config USB_DEVICE_HID
bool "USB Human Interface Device support"
help
Enables USB Human Interface Device support. Default device name
is "HID_0".
if USB_DEVICE_HID
config USB_HID_DEVICE_NAME
string "USB HID device name template"
default "HID"
help
Device name template for the HID Devices. First device would have
name $(USB_HID_DEVICE_NAME)_0, etc.
module = USB_HID
default-count = 1
source "subsys/usb/class/Kconfig.template.composite_device_number"
module = USB_HID
module-str = usb hid
source "subsys/logging/Kconfig.template.log_config"
config ENABLE_HID_INT_OUT_EP
bool "Enable USB HID Device Interrupt OUT Endpoint"
help
Enable USB HID Device Interrupt OUT Endpoint.
config HID_INTERRUPT_EP_MPS
int "USB HID Device Interrupt Endpoint size"
default 16
help
USB HID Device interrupt endpoint size
config USB_HID_POLL_INTERVAL_MS
int "Polling interval"
default 9
help
Polling interval in ms selected by the USB HID Device.
config USB_HID_REPORTS
int "HID reports in the instance"
default 1
range 1 256
help
Number of HID reports in the instance.
Must be equal or higher than highest report ID (if they are not consecutive).
config USB_HID_BOOT_PROTOCOL
bool "Enable USB HID Boot Protocol handling"
help
Sets bInterfaceSubClass to 1 and enables Set_Protocol and Get_Protocol
requests handling.
See Chapter 4.2 of Device Class Definition for Human Interface Devices 1.11
for more information.
config USB_HID_PROTOCOL_CODE
int "HID protocol code"
default 0
range 0 2
depends on USB_HID_BOOT_PROTOCOL
help
Sets bIntefaceProtocol in HID instance.
0 = None
1 = Keyboard
2 = Mouse
See Chapter 4.3 of Device Class Definition for Human Interface Devices 1.11
for more information.
endif # USB_DEVICE_HID