"linux-gpib"라는 패키지를 사용하여 USB-GPIB 어댑터에 연결하려고 합니다. 오류 없이 드라이버를 설치하고 장치를 연결했습니다.
Python에는 C API에 대한 래퍼가 있으므로 해당 함수를 사용하여 장치를 열려고 했지만 오류가 발생했습니다.
libgpib: ibBoardOpen failed to open device file /dev/gpib0
/dev를 확인했는데 장치가 존재하지 않는 것이 확실했습니다. "usb_gpib"라는 파일이 존재합니다. 따라서 내 장치가 어떻게든 시스템에 등록되고 있는 것 같지만 올바른 /dev 파일이 생성되지 않습니다. 확실하지는 않지만 "usb_gpib" 파일이 내가 찾고 있는 파일일 수 있으며 어떤 이유로 이름이 잘못되었습니다. 개발 파일 이름 지정 방법은 어떻게 결정되나요?
몇 가지 추가 검색 끝에 /etc/udev/rules.d/ 디렉토리를 찾았습니다.
다음 줄이 포함된 GPIB용 .rules 파일이 있습니다.
KERNEL=="gpib[0-9]*", ACTION=="add", MODE="660", GROUP=="plugdev"
생성된 장치가 다음과 같다고 말하는 것 같습니다.~해야 한다gpib0이지만 여전히 그렇지 않습니다.
요청한 대로 장치를 두 번 분리했다가 다시 연결하면 "udevadm monitor"가 출력되는 내용은 다음과 같습니다.
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
UDEV [32.214427] add /devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3 (usb)
ACTION=add
BUSNUM=001
DEVLINKS=/dev/usb_gpib
DEVNAME=/dev/bus/usb/001/004
DEVNUM=004
DEVPATH=/devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3
DEVTYPE=usb_device
ID_BUS=usb
ID_MODEL=702b
ID_MODEL_ENC=702b
ID_MODEL_FROM_DATABASE=GPIB-USB-B
ID_MODEL_ID=702b
ID_REVISION=0001
ID_SERIAL=3923_702b
ID_USB_INTERFACES=:ffffff:
ID_VENDOR=3923
ID_VENDOR_ENC=3923
ID_VENDOR_FROM_DATABASE=National Instruments Corp.
ID_VENDOR_ID=3923
MAJOR=189
MINOR=3
PRODUCT=3923/702b/1
SEQNUM=1077
SUBSYSTEM=usb
TYPE=255/255/255
USEC_INITIALIZED=941557
UDEV [32.228951] add /devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3/1-1.3:1.0 (usb)
ACTION=add
DEVPATH=/devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3/1-1.3:1.0
DEVTYPE=usb_interface
ID_MODEL_FROM_DATABASE=GPIB-USB-B
ID_USB_CLASS_FROM_DATABASE=Vendor Specific Class
ID_USB_PROTOCOL_FROM_DATABASE=Vendor Specific Protocol
ID_USB_SUBCLASS_FROM_DATABASE=Vendor Specific Subclass
ID_VENDOR_FROM_DATABASE=National Instruments Corp.
INTERFACE=255/255/255
MODALIAS=usb:v3923p702Bd0001dcFFdscFFdpFFicFFiscFFipFFin00
PRODUCT=3923/702b/1
SEQNUM=1078
SUBSYSTEM=usb
TYPE=255/255/255
USEC_INITIALIZED=2645
UDEV [32.347470] remove /devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3/1-1.3:1.0 (usb)
ACTION=remove
DEVPATH=/devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3/1-1.3:1.0
DEVTYPE=usb_interface
ID_MODEL_FROM_DATABASE=GPIB-USB-B
ID_USB_CLASS_FROM_DATABASE=Vendor Specific Class
ID_USB_PROTOCOL_FROM_DATABASE=Vendor Specific Protocol
ID_USB_SUBCLASS_FROM_DATABASE=Vendor Specific Subclass
ID_VENDOR_FROM_DATABASE=National Instruments Corp.
INTERFACE=255/255/255
MODALIAS=usb:v3923p702Bd0001dcFFdscFFdpFFicFFiscFFipFFin00
PRODUCT=3923/702b/1
SEQNUM=1079
SUBSYSTEM=usb
TYPE=255/255/255
USEC_INITIALIZED=2645
UDEV [32.361405] remove /devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3 (usb)
ACTION=remove
BUSNUM=001
DEVLINKS=/dev/usb_gpib
DEVNAME=/dev/bus/usb/001/004
DEVNUM=004
DEVPATH=/devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3
DEVTYPE=usb_device
ID_BUS=usb
ID_MODEL=702b
ID_MODEL_ENC=702b
ID_MODEL_FROM_DATABASE=GPIB-USB-B
ID_MODEL_ID=702b
ID_REVISION=0001
ID_SERIAL=3923_702b
ID_USB_INTERFACES=:ffffff:
ID_VENDOR=3923
ID_VENDOR_ENC=3923
ID_VENDOR_FROM_DATABASE=National Instruments Corp.
ID_VENDOR_ID=3923
MAJOR=189
MINOR=3
PRODUCT=3923/702b/1
SEQNUM=1080
SUBSYSTEM=usb
TYPE=255/255/255
USEC_INITIALIZED=941557
UDEV [34.314071] add /devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3 (usb)
ACTION=add
BUSNUM=001
DEVLINKS=/dev/usb_gpib
DEVNAME=/dev/bus/usb/001/005
DEVNUM=005
DEVPATH=/devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3
DEVTYPE=usb_device
ID_BUS=usb
ID_MODEL=702a
ID_MODEL_ENC=702a
ID_MODEL_ID=702a
ID_REVISION=0001
ID_SERIAL=3923_702a
ID_USB_INTERFACES=:ff0000:
ID_VENDOR=3923
ID_VENDOR_ENC=3923
ID_VENDOR_FROM_DATABASE=National Instruments Corp.
ID_VENDOR_ID=3923
MAJOR=189
MINOR=4
PRODUCT=3923/702a/1
SEQNUM=1081
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=1346
UDEV [34.368446] add /devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3/1-1.3:1.0 (usb)
ACTION=add
DEVPATH=/devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3/1-1.3:1.0
DEVTYPE=usb_interface
ID_VENDOR_FROM_DATABASE=National Instruments Corp.
INTERFACE=255/0/0
MODALIAS=usb:v3923p702Ad0001dc00dsc00dp00icFFisc00ip00in00
PRODUCT=3923/702a/1
SEQNUM=1082
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=2286
UDEV [39.006199] remove /devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3/1-1.3:1.0 (usb)
ACTION=remove
DEVPATH=/devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3/1-1.3:1.0
DEVTYPE=usb_interface
ID_VENDOR_FROM_DATABASE=National Instruments Corp.
INTERFACE=255/0/0
MODALIAS=usb:v3923p702Ad0001dc00dsc00dp00icFFisc00ip00in00
PRODUCT=3923/702a/1
SEQNUM=1083
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=2286
UDEV [39.013553] remove /devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3 (usb)
ACTION=remove
BUSNUM=001
DEVLINKS=/dev/usb_gpib
DEVNAME=/dev/bus/usb/001/005
DEVNUM=005
DEVPATH=/devices/soc0/amba@0/e0002000.usb/ci_hdrc.0/usb1/1-1/1-1.3
DEVTYPE=usb_device
ID_BUS=usb
ID_MODEL=702a
ID_MODEL_ENC=702a
ID_MODEL_ID=702a
ID_REVISION=0001
ID_SERIAL=3923_702a
ID_USB_INTERFACES=:ff0000:
ID_VENDOR=3923
ID_VENDOR_ENC=3923
ID_VENDOR_FROM_DATABASE=National Instruments Corp.
ID_VENDOR_ID=3923
MAJOR=189
MINOR=4
PRODUCT=3923/702a/1
SEQNUM=1084
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=1346