jiegec / usbip

A Rust library to run a USB/IP server
MIT License
306 stars 30 forks source link

CP2112 shared problem (error setting SMBus config) #49

Open lgzcoollg opened 8 months ago

lgzcoollg commented 8 months ago

OS Server: MacOS 13.6.4 (22G513) Intel Client: Linux ubuntu-labview 5.15.0-101-generic. and windows 10 usbip-win-client


@After Connection: Server: [2024-03-28T09:28:12Z INFO usbip] Handler ended with Ok(()) [2024-03-28T09:28:33Z INFO usbip] Got connection from Ok(192.168.XX.XX:47526)

@Client: 1, usbip list -r: 20-4-1: Genesys Logic, Inc. : 4-port hub (05e3:0610) : /sys/bus/20/4/1 : Hub / Unused / Single TT (09/00/01) : 0 - Hub / Unused / Full speed (or root) hub (09/00/00)

2, lsusb: Bus 001 Device 002: ID 10c4:ea90 Silicon Labs CP2112 HID I2C Bridge

3, dmesg: [ 124.060224] vhci_hcd vhci_hcd.0: USB/IP Virtual Host Controller [ 124.060232] vhci_hcd vhci_hcd.0: new USB bus registered, assigned bus number 1 [ 124.060244] vhci_hcd: created sysfs vhci_hcd.0 [ 124.060311] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.15 [ 124.060316] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 124.060319] usb usb1: Product: USB/IP Virtual Host Controller [ 124.060323] usb usb1: Manufacturer: Linux 5.15.0-101-generic vhci_hcd [ 124.060325] usb usb1: SerialNumber: vhci_hcd.0 [ 124.060485] hub 1-0:1.0: USB hub found [ 124.060493] hub 1-0:1.0: 8 ports detected [ 124.060677] vhci_hcd vhci_hcd.0: USB/IP Virtual Host Controller [ 124.060680] vhci_hcd vhci_hcd.0: new USB bus registered, assigned bus number 2 [ 124.060697] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM. [ 124.060726] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.15 [ 124.060730] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 124.060733] usb usb2: Product: USB/IP Virtual Host Controller [ 124.060736] usb usb2: Manufacturer: Linux 5.15.0-101-generic vhci_hcd [ 124.060738] usb usb2: SerialNumber: vhci_hcd.0 [ 124.060825] hub 2-0:1.0: USB hub found [ 124.060831] hub 2-0:1.0: 8 ports detected [ 125.605587] vhci_hcd vhci_hcd.0: pdev(0) rhport(0) sockfd(3) [ 125.605603] vhci_hcd vhci_hcd.0: devid(1310723) speed(2) speed_str(full-speed) [ 125.605630] vhci_hcd vhci_hcd.0: Device attached [ 125.779236] vhci_hcd: vhci_device speed not set [ 125.839294] usb 1-1: new full-speed USB device number 2 using vhci_hcd [ 125.907292] vhci_hcd: vhci_device speed not set [ 125.967284] usb 1-1: SetAddress Request (2) to port 0 [ 125.997752] usb 1-1: New USB device found, idVendor=10c4, idProduct=ea90, bcdDevice= 0.00 [ 125.997771] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 125.997781] usb 1-1: Product: FQDD-WB-A1.1 [ 125.997788] usb 1-1: Manufacturer: Silicon Laboratories [ 125.997796] usb 1-1: SerialNumber: FQDD-WB-A1.1-001 [ 126.046371] hid: raw HID events driver (C) Jiri Kosina [ 126.060660] usbcore: registered new interface driver usbhid [ 126.060672] usbhid: USB HID core driver [ 126.097325] cp2112 0003:10C4:EA90.0001: hidraw0: USB HID v1.01 Device [Silicon Laboratories FQDD-WB-A1.1] on usb-vhci_hcd.0-1/input0 [ 126.156285] cp2112 0003:10C4:EA90.0001: Part Number: 0x0C Device Version: 0x03 [ 126.160031] cp2112 0003:10C4:EA90.0001: error setting SMBus config [ 126.161332] cp2112: probe of 0003:10C4:EA90.0001 failed with error -5 [ 126.208356] vhci_hcd: unlink->seqnum 82 [ 126.208376] vhci_hcd: the urb (seqnum 82) was already given back


Use the Chip SDK test:

./hidSMBusExample

Device 0 Information: HidSmbus_Open(): HID_SMBUS_SUCCESS VID = 0x10C4 PID = 0xEA90 Release Number = 0.00 Part Number = 12 Version = 3 Serial = FQDD-WB-A1.1-001 Manufacturer = Silicon Laboratories Product = FQDD-WB-A1.1 Bit Rate = 100000 Hz Slave Address = 02 Auto Send Read Response = false Write Timeout = 0 ms Read Timeout = 0 ms Transfer Retries = 1 SCL Low Timeout = false ==================== HidSmbus_GetSmbusConfig():HID_SMBUS_SUCCESS Response Timeout = 1000 ms ==================== HidSmbus_GetTimeouts():HID_SMBUS_SUCCESS GPIO0Mode = GPIO_INPUT_OPEN_DRAIN GPIO1Mode = GPIO_INPUT_OPEN_DRAIN GPIO2Mode = GPIO_INPUT_OPEN_DRAIN GPIO3Mode = GPIO_INPUT_OPEN_DRAIN GPIO4Mode = GPIO_INPUT_OPEN_DRAIN GPIO5Mode = GPIO_INPUT_OPEN_DRAIN GPIO6Mode = GPIO_INPUT_OPEN_DRAIN GPIO7Mode = GPIO_INPUT_OPEN_DRAIN Clock Out Divider = 0 Clock Out Divider = 48000000 ==================== HidSmbus_GetGpioConfig():HID_SMBUS_SUCCESS LatchValue = 0x17 ==================== HidSmbus_ReadLatch: HID_SMBUS_SUCCESS Custom Vid: 0x10C4 Custom Pid: 0xEA90 Custom Power: 100 mA Custom Power Mode: HID_SMBUS_BUS_POWER Release Version: 01.00 ==================== HidSmbus_GetUsbConfig: HID_SMBUS_SUCCESS HID_SMBUS_LOCK_VID: 1 HID_SMBUS_LOCK_PID: 1 HID_SMBUS_LOCK_POWER: 1 HID_SMBUS_LOCK_POWER_MODE: 1 HID_SMBUS_LOCK_RELEASE_VERSION: 1 HID_SMBUS_LOCK_MFG_STR: 1 HID_SMBUS_LOCK_PRODUCT_STR: 0 HID_SMBUS_LOCK_SERIAL_STR: 0 ==================== HidSmbus_GetLock: HID_SMBUS_SUCCESS Manufacturing String: Silicon Laboratories ==================== HidSmbus_GetManufacturingString: HID_SMBUS_SUCCESS Product String: FQDD-WB-A1.1 ==================== HidSmbus_GetProductString: HID_SMBUS_SUCCESS Serial String: FQDD-WB-A1.1-001 ==================== HidSmbus_GetSerialString: HID_SMBUS_SUCCESS ==================== HidSmbus_Close(): HID_SMBUS_SUCCESS


i2cdetect -l non i2c bus....


Summary

through this usbip server. I did can control the CP2112 GPIO. but the i2c bus did not trans out.

P.S 1, I try to control at the local OS (macOS), It fine. 2, I try to use the virtualhere server at macOS and the virtualhere client at windows10, is fine too. 3, I try to use the usbip-win server at windows10 and the usbip client at this ubuntu, is fine too.

thanks a lot to help

jiegec commented 7 months ago

It is possible that the SMBus feature uses something not well-implemented.