Access to USB ports to connect to a UPS
Hi, I'm running Box86 on a Raspberry Pi 4 (which runs 32 bit Rasbian).
I am trying to use a program called UPSmart which is available for 32 or 64 bit Linux but complains about needing x86 architecture when I try it on the Pi.
So, I have just discovered Box86 which appears be brilliant and seems to run fine on the Pi, bringing up the UPSmart interface just as it does on x86 or x86_64 Linux.
Problem is when I choose the connection type of USB it refuses to connect.
I've tested all the kit with a standard x86 Linux laptop and the software connects OK so I would guess we need to be able to map the USB port from the underlying OS to Box86 like we do in Docker, Vmware, etc.
Please note, this is native Linux software so Wine is not involved.
Any thoughts please?
Many thanks
Use BOX86_LOG=1 BOX86_DLSYM_ERROR=1 env. var. and try again. Maybe some function from some libusb need some wrapping (and I will need the log generated)
Thanks. Been trying since last night to work out where the logs are created! I've looked in /var/logs and searched for hidden and tmp directories but I'm stumped.
Oops, just found that the env. var. BOX86_TRACE_FILE is supposed to direct the log to a file but when I run my app it just logs everything to the screen and when I exit the app, no log is created at the path that I specify....
This is what I see on the screen (no mention of libusb):
root@2SRNPi1:/opt/UPSmart# ./UPSmart Debug level is 1 Dynarec for ARMv8, with extension: HALF FAST_MULT EDSP NEON VFPv4 IDIVA PageSize:4096 Box86 with Dynarec v0.2.7 6af8045c built on May 23 2022 18:58:52 Using default BOX86_LD_LIBRARY_PATH: ./:lib/:lib32/:x86/:i686/ Using default BOX86_PATH: ./:bin/ Counted 25 Env var Looking for ./UPSmart Using native(wrapped) libXrender.so.1 Using native(wrapped) libX11.so.6 Using native(wrapped) libdl.so.2 Using native(wrapped) libxcb.so.1 Using native(wrapped) libXau.so.6 Using native(wrapped) libXdmcp.so.6 Using native(wrapped) libXext.so.6 Using native(wrapped) librt.so.1 Using native(wrapped) libpthread.so.0 Using emulated /lib/i386-linux-gnu/libstdc++.so.6 Using native(wrapped) libm.so.6 Using emulated /lib/i386-linux-gnu/libgcc_s.so.1 Using native(wrapped) libc.so.6 Using native(wrapped) ld-linux.so.2 BOX86: Call to dlopen("libXrandr.so.2"/0x6381ce58, 1) Using native(wrapped) libXrandr.so.2 dlopen: New handle 0x1 (libXrandr.so.2), dlopened=1 Call to dlsym(0x1, XRRSelectInput) :0x6381f000 Call to dlsym(0x1, XRRUpdateConfiguration) :0x6381f010 Call to dlsym(0x1, XRRRootToScreen) :0x6381f020 Call to dlsym(0x1, XRRQueryExtension) :0x6381f030 X Error: RenderBadPicture (invalid Picture parameter) 143 Extension: 139 (RENDER) Minor opcode: 8 (RenderComposite) Resource id: 0x634d0050
Ah ok. How that device is supposed to be controled? Maybe it's supposed to be recognised by some kernel driver and create a virtual file in /dev/ or something like that. You should check in dmseg if you see some error when you connect the UPSmart device to the pi.
Hello. Many thanks for your help.
I restarted the pi without the USB UPS connected, ran dmesg as root (dmesg -T --follow) and watched the messages as I connected the USB device:
[Thu May 26 10:08:39 2022] usb 1-1.2: new full-speed USB device number 3 using xhci_hcd [Thu May 26 10:08:39 2022] usb 1-1.2: string descriptor 0 read error: -22 [Thu May 26 10:08:39 2022] usb 1-1.2: New USB device found, idVendor=0001, idProduct=0000, bcdDevice= 1.00 [Thu May 26 10:08:39 2022] usb 1-1.2: New USB device strings: Mfr=0, Product=1, SerialNumber=0 [Thu May 26 10:08:40 2022] hid-generic 0003:0001:0000.0001: hiddev96,hidraw0: USB HID v1.11 Device [HID 0001:0000] on usb-0000:01:00.0-1.2/input0
Then I started the software, disconnected the USB, reconnected it and soon afterwards I tried connecting it on a different port:
[Thu May 26 10:10:01 2022] process 'usr/local/bin/box86' started with executable stack [Thu May 26 10:11:00 2022] usb 1-1.2: USB disconnect, device number 3 [Thu May 26 10:11:11 2022] usb 1-1.2: new full-speed USB device number 4 using xhci_hcd [Thu May 26 10:11:12 2022] usb 1-1.2: string descriptor 0 read error: -22 [Thu May 26 10:11:12 2022] usb 1-1.2: New USB device found, idVendor=0001, idProduct=0000, bcdDevice= 1.00 [Thu May 26 10:11:12 2022] usb 1-1.2: New USB device strings: Mfr=0, Product=1, SerialNumber=0 [Thu May 26 10:11:12 2022] hid-generic 0003:0001:0000.0002: hiddev96,hidraw0: USB HID v1.11 Device [HID 0001:0000] on usb-0000:01:00.0-1.2/input0 [Thu May 26 10:11:40 2022] usb 1-1.2: USB disconnect, device number 4 [Thu May 26 10:11:51 2022] usb 1-1.4: new full-speed USB device number 5 using xhci_hcd [Thu May 26 10:11:52 2022] usb 1-1.4: string descriptor 0 read error: -22 [Thu May 26 10:11:52 2022] usb 1-1.4: New USB device found, idVendor=0001, idProduct=0000, bcdDevice= 1.00 [Thu May 26 10:11:52 2022] usb 1-1.4: New USB device strings: Mfr=0, Product=1, SerialNumber=0 [Thu May 26 10:11:52 2022] hid-generic 0003:0001:0000.0003: hiddev96,hidraw0: USB HID v1.11 Device [HID 0001:0000] on usb-0000:01:00.0-1.4/input0
Does this give you any clues? There don't seem to be any errors and the device is listed when I execute lsusb as:
root@2SRNPi1:/opt/UPSmart# lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 005: ID 0001:0000 Fry's Electronics Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Thanks
I have fixed an issue (unrelated to USB reading), so the "X Error: RenderBadPicture (invalid Picture parameter) 143" error is gone.
I don't have any UPS at home, so I cannot really test the software on my side. I have downloaded it and launched it. What I see is that, when configured with a Singla phase/USB thingy, it open /dev/bus/usb folder and search for something. It also look for /sys/bus/usb/devices and also for /sys/bus/devices/1-2:1.2 and many more stuffs.
So I would guess some specific driver are missing on armhf, making the usb UPS not visible as intended by the software.
(if you want a detailled view of all function call, use BOX86_LOG2 ./UPSmart >trace.txt 2>&1 to create a (very large) trace.txt file containing all wrapped functions call. Look for "usb" to see all the file it tries to open...
Hi,
I had to use BOX86_LOG=2 ./UPSmart >trace.txt 2>&1 which I presume is what you meant? And as you say I've got a huge file which means nothing to me. I am uploading it here just in case you are able to help. It would be nice to get the software to talk to the UPS but not to worry if you can't help but big thanks for your attempts.
I don't see anything that could help. I see it browse though all the usb driver, but I don't know what it is looking for.
You could try to see what dmseg looks like on an x86 pc when you plug the UPS, to see if the Pi is handling it correctly also.
Apologies for slow response. I will get round to this but it's going to take a while as it's at a friend's house (he doesn;t use Linux) so I'll have to build a Linux box and take it round when we both are available.....
Thanks for your help....
Not sure how this ticket can progress further. Maybe it should be closed?
Hm, yes, I think you are probably right. I'd love to get it fixed but the hardware is not mine and my friend has lost interest and is now using a long USB over RJ45 to connect to a Windows laptop instead.
Thanks for your help...