How to call D-Bus method that expects array of bytes using busctl command line tool

4k views Asked by At

I'm trying to do busctl call of a method that takes array of bytes as arguments (signature ay). How do I do this?

This is what I've tried so far:

# busctl call ${SERVICE_IFACE} ${THE_OBJECT} ${SERVICE_IFACE} ${METHOD} ay 0x00 0x00 0x01 0x00 0xaf
Too many parameters for signature.
# busctl call ${SERVICE_IFACE} ${THE_OBJECT} ${SERVICE_IFACE} ${METHOD} yyyyy 0x00 0x00 0x01 0x00 0xaf
Call failed: Invalid arguments 'yyyyy' to call xyz.openbmc_project.Control.Haven.SendHostCommand(), expecting 'ay'.
# busctl call ${SERVICE_IFACE} ${THE_OBJECT} ${SERVICE_IFACE} ${METHOD} a5y 0x00 0x00 0x01 0x00 0xaf
Invalid array signature: Invalid argument
# busctl call ${SERVICE_IFACE} ${THE_OBJECT} ${SERVICE_IFACE} ${METHOD} ay '0x00 0x00 0x01 0x00 0xaf'
Failed to parse '0x00 0x00 0x01 0x00 0xaf' number of array entries: Invalid argument

So, what does it want?

1

There are 1 answers

0
ukBaz On BEST ANSWER

I believe you need to put the length of the array before the values. So in your example that would be:

busctl call ${SERVICE_IFACE} ${THE_OBJECT} ${SERVICE_IFACE} ${METHOD} ay 5 0x00 0x00 0x01 0x00 0xaf