daliserver icon indicating copy to clipboard operation
daliserver copied to clipboard

daliserver in VM not working

Open rnixx opened this issue 9 years ago • 20 comments

Hi,

I tried to setup daliserver in a ubuntu 14.04 guest on a windows 10 host with virtualbox. The USB device filter for the VM is configured properly to access Lunatone DALI USB through guest system.

When trying to start daliserver with "/etc/init.d/daliserver start", following gets written to "/var/log/daliserver.log":

[2016-00-04 13:17:10] INFO Starting daliserver
[2016-00-04 13:17:15] **ERROR** Error setting configuration: Other error
[2016-00-04 13:17:50] **ERROR** Error reattaching interface: Not found

Any hints how I can solve this?

rnixx avatar Jan 04 '16 12:01 rnixx

Can you recompile daliserver with debug messages and run it from the console, please?

$ ./configure --enable-debug
$ make clean && make
$ src/daliserver -d debug

This should give a better view of what's going on.

onitake avatar Jan 04 '16 14:01 onitake

/tmp/daliserver# src/daliserver -d debug
[2016-00-07 09:37:40] Parsing options
DALI USB multiplexer (daliserver)
Copyright (c) 2011 onitake All rights reserved.

[2016-00-07 09:37:40] INFO Starting daliserver
[2016-00-07 09:37:40] Initializing dispatch queue
[2016-00-07 09:37:40] Initializing USB connection
[2016-00-07 09:37:40] Trying to find DALI USB device at -1:-1
[2016-00-07 09:37:40] Ignoring USB device [VID=0x1d6b PID=0x0002]
[2016-00-07 09:37:40] Input endpoint: 0x81
[2016-00-07 09:37:40] Output endpoint: 0x02
[2016-00-07 09:37:45] **ERROR** Error setting configuration: Other error
[2016-00-07 09:38:20] **ERROR** Error reattaching interface: Not found
Speicherzugriffsfehler (Speicherabzug geschrieben)

rnixx avatar Jan 07 '16 08:01 rnixx

Does the message at the end mean that daliserver crashed? Ouch. I'll need to look into this. If you could run daliserver in gdb and post the backtrace, that would help.

Also, to find out why it doesn't work on your machine, it would be nice if you could mail me or create a gist with the output of lsusb -v with the adapter plugged in.

onitake avatar Jan 07 '16 15:01 onitake

Speicherzugriffsfehler means segfault. I'm going to provide you the backtrace as soon as I have access to the related VM

rnixx avatar Jan 08 '16 07:01 rnixx

lsusb -v https://gist.github.com/rnixx/a9b41f94b379b85940ae

gdb src/daliserver https://gist.github.com/rnixx/f18755ed80f8fe6344c0

rnixx avatar Jan 08 '16 09:01 rnixx

Interesting that lsusb was unable to fetch the manufacturer, product and serial number strings from the device.

sde1000 avatar Jan 08 '16 15:01 sde1000

When running lsusb on a non-VM linux, iManufacturer, iProduct, and iSerial are empty

rnixx avatar Jan 08 '16 15:01 rnixx

Are you root when you run lsusb -v?

sde1000 avatar Jan 08 '16 15:01 sde1000

no

rnixx avatar Jan 08 '16 15:01 rnixx

You need to be root for it to be able to fetch strings from devices (because this involves actually making requests to the device, rather than just reading from information already stored by the kernel).

sde1000 avatar Jan 08 '16 15:01 sde1000

Actually I don't think that reading these strings count that much related to the issue, since daliserver has been started as root. But I can update lsusb output anyway. Need to go now, more ASAP

rnixx avatar Jan 08 '16 15:01 rnixx

As root on my local machine I get manufacturer, product and serial

Bus 001 Device 071: ID 17b5:0020 Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x17b5 idProduct 0x0020 bcdDevice 1.10 iManufacturer 1 Lunatone iProduct 2 DALI USB iSerial 3 00018FC4 bNumConfigurations 1

rnixx avatar Jan 11 '16 09:01 rnixx

As root in the virtual machine I get the error

Bus 002 Device 003: ID 17b5:0020 Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x17b5 idProduct 0x0020 bcdDevice 1.10 iManufacturer 1 (error) iProduct 2 (error) iSerial 3 (error) bNumConfigurations 1

rnixx avatar Jan 11 '16 10:01 rnixx

I suspected that the segfault might happen in libusb_free_config_descriptor, and I think I just found out why. I'm calling it twice on error. Will send a patch shortly.

As for the reason why it's not working for your adapter, I'm not sure. We're trying to using open configuration value 1, and it fails for an unknown reason. Did you test daliserver in a non-VM environment? It should work in kvm/qemu, though, I'm using that myself. Perhaps a comparison with my own adapter's USB descriptor helps. I'll post anything I find.

onitake avatar Jan 11 '16 18:01 onitake

Patch is up (b171483). Also, I added a check in 5d860e1 to avoid reattaching the device to the kernel if it was not detached.

onitake avatar Jan 11 '16 18:01 onitake

@rnixx, can you test if it works now?

onitake avatar Feb 03 '16 16:02 onitake

@onitake, will give it at try tomorrow. thanks

rnixx avatar Feb 03 '16 19:02 rnixx

Sorry for the late reply. We are still not able to get daliserver running in the VM. Daliserver stops with "Error setting configuration: Other error". The problem might be somewhere deeper in the system, since lsusb is also not able to read the device correctly. I'm quite busy ATM with daily business, but will give it another try as soon as I can.

rnixx avatar Feb 18 '16 13:02 rnixx

Ok. Since I do not get this error when I run daliserver in KVM (with USB passthrough), I don't really know how to help without more information.

Did my patch at least fix the segmentation fault?

onitake avatar Feb 18 '16 14:02 onitake

yes, no segfault any more, thx!

rnixx avatar Feb 18 '16 14:02 rnixx