karosium / smbusb

USB SMBus Interface
GNU Lesser General Public License v2.1
141 stars 42 forks source link

Error Opening SMBusb: libusb error -11 #14

Closed tremez closed 4 years ago

tremez commented 4 years ago

Hi I am constantly getting following error : Error Opening SMBusb: libusb error -11 both for smbusb_sbsreport and smbusb_scan

Device is enumerated as Bus 001 Device 006: ID 04b4:8613 Cypress Semiconductor Corp. CY7C68013 EZ-USB FX2 USB 2.0 Development Kit

Any assistance is appreciated

0r10nV commented 4 years ago

If you are working in Linux check permissions. Same issue was solved here.

http://www.karosium.com/2016/08/hacking-bq8030-with-sanyo-firmware.html?showComment=1511814009888#c8945243386522181427

tremez commented 4 years ago

I am running under root in the Virtualbox VM There are no errors in dmesg [Thu Nov 28 13:55:10 2019] usb 1-1: new high-speed USB device number 3 using ehci-pci [Thu Nov 28 13:55:11 2019] usb 1-1: New USB device found, idVendor=04b4, idProduct=8613 [Thu Nov 28 13:55:11 2019] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 lsusb Bus 001 Device 003: ID 04b4:8613 Cypress Semiconductor Corp. CY7C68013 EZ-USB FX2 USB 2.0 Development Kit

root@bubuntu:~# smbusb_sbsreport Error Opening SMBusb: libusb error -11 root@bubuntu:~#

tremez commented 4 years ago

Tried sigrok on same VM - all works like a charm

tremez commented 4 years ago

error -11 sound like LIBUSB_ERROR_NO_MEM

tremez commented 4 years ago

After some random manipulations i see that device ID have changed to SMBUsb and following dat a was received SMBusb Firmware Version: 1.0.1

Manufacturer Name: ERROR Device Name: ERROR Device Chemistry: ERROR Serial Number: 4294967287 Manufacture Date: 8390587.15.23

Manufacturer Access: fffffff7 Remaining Capacity Alarm: 4294967287 mAh(/10mWh) Remaining Time Alarm: 4294967287 min Battery Mode: fffffff7 At Rate: -9 mAh(/10mWh) At Rate Time To Full: 4294967287 min At Rate Time To Empty: 4294967287 min At Rate OK: 4294967287 Temperature: -274.05 degC Voltage: 4294967287 mV Current: -9 mA Average Current: -9 mA Max Error: 4294967287 % Relative State Of Charge 4294967287 % Absolute State Of Charge 4294967287 % Remaining Capacity: 4294967287 mAh(/10mWh) Full Charge Capacity: 4294967287 mAh(/10mWh) Run Time To Empty: 4294967287 min Average Time To Empty: 4294967287 min Average Time To Full: 4294967287 min Charging Current: 4294967287 mA Charging Voltage: 4294967287 mV Battery Status: fffffff7 Cycle Count: 4294967287 Cell 0 voltage: 0 mV Cell 1 voltage: 0 mV Cell 2 voltage: 0 mV Cell 3 voltage: 0 mV

tremez commented 4 years ago

Ok, I won it Problem was due to virtual box usb settings, i had to select USB3 instead USB2. Hope it helps for the future

0r10nV commented 4 years ago

Good to know!

Meanwhile have looked through the code and noticed error -11 in that particular case means error downloading firmware to device and not the LIBUSB_ERROR_NO_MEM. It comes from InitDevice() function and defined in libsmbusb.h header,

#define ERR_FIRMWARE_DOWNLOAD -11

@karosium Could we redefine it to something unique to avoid confusion?

karosium commented 4 years ago

@tremez: Glad you could get it to work

@0r10nV: I'll look into this when I have some free time. I've been meaning to add human-readable error messages since the release.