Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

driver: ctrl_timeoutをモジュールパラメーターに追加 #3

Merged
merged 1 commit into from
Sep 30, 2023

Conversation

masnagam
Copy link

@masnagam masnagam commented Sep 30, 2023

表題の通り,ctrl_timeoutをモジュールパラメーターに追加する修正です.

背景

Linux Kernel 6.xで以下のようなエラーをよく目にするようになりました.

# dmesgより抜粋
it930x_ctrl_msg: operation failed. (cmd: 0x002b, ret: -110)

ここで-110ETIMEDOUTです.

tcpdump + usbmonでusbでのやり取りを取得したところ,既定値の3000ms後に応答をちゃんと受信している場合があることが確認できました.遅延の原因はまだ不明ですが,それまでの対処療法としてctrl_timeoutをモジュールパラメーターに追加しました.

以下を追加後,再起動.

# /etc/modprobe.d/px4_drv.conf
options px4_drv ctrl_timeout=5000 psb_purge_timeout=5000

ROCK64 + PX-W3U4上で動作しているmirakcによる4チャンネルのタイムシフト録画を行い4日経ちましたが,上記エラーは発生していません.
タイムアウト値は環境に依存するものと推測しますが,調整することによりエラーを回避できることが分かりました.

補足

usb_bulk_msgの詳細は https://manpages.debian.org/jessie-backports/linux-manual-4.8/usb_bulk_msg.9

mirakcのonair-program-trackers使用時に発生しているように見えることから,同一チューナーにて別チャンネルのストリームに短い時間間隔で切り替えると発生するのかもしれません.これは推測であり,詳細はまだ不明です.

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()`.
@tsukumijima
Copy link
Owner

プルリクエストをありがとうございます!
私は複数のフォークでの修正をまとめたり小手先の調整をする程度で Linux カーネルドライバプログラミングは全くの門外漢なのですが、コードを読む限り既存環境への影響はなさそうに見えます。マージさせていただきます!🙏

@tsukumijima tsukumijima merged commit 8ae929f into tsukumijima:develop Sep 30, 2023
tsukumijima pushed a commit that referenced this pull request Sep 30, 2023
otya128氏のメモリ処理変更を取り込んでみる
@masnagam masnagam deleted the feat-ctrl_timeout branch October 2, 2023 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants