mirror of
https://github.com/tsukumijima/px4_drv.git
synced 2025-07-23 04:03:01 +02:00
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()`.
This commit is contained in:
@@ -84,7 +84,7 @@ static int px4_usb_init_bridge(struct device *dev, struct usb_device *usb_dev,
|
||||
bus->dev = dev;
|
||||
bus->type = ITEDTV_BUS_USB;
|
||||
bus->usb.dev = usb_dev;
|
||||
bus->usb.ctrl_timeout = 3000;
|
||||
bus->usb.ctrl_timeout = px4_usb_params.ctrl_timeout;
|
||||
bus->usb.streaming.urb_buffer_size = 188 * px4_usb_params.urb_max_packets;
|
||||
bus->usb.streaming.urb_num = px4_usb_params.max_urbs;
|
||||
bus->usb.streaming.no_dma = px4_usb_params.no_dma;
|
||||
|
@@ -11,12 +11,19 @@
|
||||
#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,
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include <linux/types.h>
|
||||
|
||||
struct px4_usb_param_set {
|
||||
int ctrl_timeout;
|
||||
unsigned int xfer_packets;
|
||||
unsigned int urb_max_packets;
|
||||
unsigned int max_urbs;
|
||||
|
Reference in New Issue
Block a user