If you have a model with more than one USB bus, and you create a USB device on the command line without specifying which bus to plug it into, QEMU will choose a different bus depending on whether you use the legacy "-usbdevice keyboard" or the qdev "-device usb-kbd".
This is because the legacy option finds the USB bus with usb_bus_find(), which searches the 'busses' list, which is populated by usb_bus_new(), with each new bus added to the tail of the list. The qdev option looks for the USB bus with qbus_find_recursive(), which walks the qdev tree. Since qbus_create_inplace() adds each new child bus to the front of the parent's child_bus list, this means that qbus_find_recursive() will encounter the last-added bus first, whereas usb_bus_find() will get the first-added bus. I assume this is likely to apply to other bus types as well. Is there anything we can do to fix this inconsistency [*], or are we tied to the existing enumeration orders in both cases for compatibility with users with currently-working command lines or configurations? [*] the actual code changes are simple enough, obviously -- PMM