Files
px4_drv/driver/px4_usb_params.c
masnagam fe4d37c0c9 feat: add ctrl_timeout as a module parameter
Sending a request by `it930x_ctrl_msg()` sometimes fails due to the
error code -110 (ETIMEDOUT).  However, in some situations, the
response seems to be received after the ETIMEDOUT error.  This can be
observed by capturing packets using `tcpdump` + `usbmon`.

```shell
sudo modprobe usbmon
sudo tcpdump -i usbmon<n> -s0 -U -w - | tee /path/to/capture.pcap | \
  tcpdump -r -
```

Actually, no ETIMEDOUT error occur during timeshift recording with the
following settings at least on my environment (ROCK64 + PX-W3U4):

```text
options px4_drv ctrl_timeout=5000 psb_purge_timeout=5000
```

These two timeout values are eventually passed to `usb_bulk_msg()`.
2023-09-27 18:51:07 +09:00

43 lines
1.3 KiB
C

// SPDX-Licence-Identifier: GPL-2.0-only
/*
* Module parameter definitions (px4_usb_params.c)
*
* Copyright (c) 2018-2021 nns779
*/
#include "px4_usb_params.h"
#include <linux/kernel.h>
#include <linux/module.h>
struct px4_usb_param_set px4_usb_params = {
.ctrl_timeout = 3000,
.xfer_packets = 816,
.urb_max_packets = 816,
.max_urbs = 6,
.no_dma = false
};
module_param_named(ctrl_timeout, px4_usb_params.ctrl_timeout,
int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(ctrl_timeout,
"Time in msecs to wait for the message to complete " \
"before timing out (if 0 the wait is forever). (default: 3000)");
module_param_named(xfer_packets, px4_usb_params.xfer_packets,
uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(xfer_packets,
"Number of transfer packets from the device. (default: 816)");
module_param_named(urb_max_packets, px4_usb_params.urb_max_packets,
uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(urb_max_packets,
"Maximum number of TS packets per URB. (default: 816)");
module_param_named(max_urbs, px4_usb_params.max_urbs,
uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(max_urbs, "Maximum number of URBs. (default: 6)");
module_param_named(no_dma, px4_usb_params.no_dma,
bool, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);