Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

canIoCtlInit failes with canERR_PARAM (-1) on Kvaser Leaf Light v2 for Linux

Đang mở
#2,079 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
backend, embedded-iot

Hướng nghiên cứu

Bắt đầu trong KvaserBus.init tại lệnh gọi canIoCtlInit cho canIOCTL_SET_LOCAL_TXACK, rồi so sánh hành vi với issue liên quan #2051 trong khi tái hiện vấn đề bằng Kvaser Leaf Light v2 và cấu hình Bus được cung cấp. Được xem là hoàn tất khi bus Kvaser khởi tạo thành công trên Linux mà không làm ảnh hưởng đến hành vi local-TX-ack; hãy xác minh bằng cách tái hiện trên thiết bị.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Describe the bug

Creating a bus fails during initialization. I'm using the Kvaser backend under Linux with a Kvaser Leaf Light v2. Using the Leaf Light v2 on Windows the same function is successful

import can

bus = can.Bus(
    interface="kvaser",
    channel=0,
    bitrate=500000,
)

raises

can.interfaces.kvaser.canlib.CANLIBOperationError:
Function canIoCtl failed - Error in parameter [Error Code -1]
To Reproduce
  1. Attach a Kvaser Leaf Light dongle (I used the Leaf V2)
  2. initialize the bus with can.interface.Bus(interface='kvaser', channel=0, bitrate=500000)
Expected behavior

The bus will initialize without any errors thrown

Additional context

OS and version: Fedora 44
Python version: 3.14.6
python-can version: 4.6.1
python-can interface/s (if applicable): Kvaser Leaf Light v2 and Kvaser Linux SDK 5.52

Investigateion

I verified that...

  • can.detect_available_configs() correctly discovers the device.
  • canOpenChannel() succeeds
  • the Channel can be opened directly using the CANlib bindings
  • the failure occurs during the initialization of canIoCtlInit() calls in KbaserBus.__init__()

The failure occurs on canIOCTL_SET_LOCAL_TXACK or specifically...

canIoCtlInit(
    self._read_handle,
    canstat.canIOCTL_SET_LOCAL_TXACK,
    ctypes.byref(ctypes.c_byte(local_echo)),
    1,
)
Work-Around

commenting out this section of code allows me to continue initializing the bus and my program runs smoothly.

Potentially related Issue

#2051

Ngôn ngữ chính
Python
Star
1.6k
Fork
697
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của hardbyte/python-can

Tất cả issue của hardbyte/python-can

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.