I would like to know what kind of motor (XL, L) is connected to EV3 output port (A|B|C|D). I need to use direct command:

Instruction        opOutput_Get_Type (LAYER, NO, *TYPE)
Opcode             0xA0
Arguments          (Data8) LAYER – Specify chain layer number [0 - 3]
                   (Data8) NO – Port number [0 - 3]
                   (Data8) *TYPE

so request should looks like:

unsigned const char opOutput_Get_Type[] {
    0x09, 0x00, // bytes in message
    0x00, 0x00, // message counter
    0x00,       // DIRECT_COMMAND_REPLY
    0x01, 0x00, // 1 value will be returned
    0xA0,       // opOutput_Get_Type
    LC0(0),     // LAYER 0, first brick in chain
    LC0(0),     // port A
    GV0(0)      // returned value

When I send it to brick a get response:

04000000 0400

which stands that error occurred. Motor is connected to port A. What am I doing wrong?

2 Answers 2


Checking the source code, it appears that the opOutput_Get_Type command is not implemented. In both links, it is mentioned in the comments, but there is nothing in the actual code.

Unfortunately, I am not finding a different way to get this information.


The one who wants to know device type should use direct command:

Instruction        opInput_Device (CMD, ...)
Opcode             0x99
CMD                GET_TYPEMODE = 0x05
                   (Data8) LAYER – Specify chain layer number [0 - 3]
                   (Data8) NO – Port number [0 - 3]
                   (Data8) TYPE
                   (Data8) MODE - Device mode [0-7]

In order to discover all ports we should send

unsigned const char opOutput_Get_Type[] {
    0x35, 0x00,                                 //Message size = 53 bytes (0x35 hex)
    0x00, 0x00,                                 //Message Counter
    0x00,                                       //DIRECT_COMMAND_REPLY
    0x10, 0x00,                                 //16 values will be returned... 8 pairs (type, mode)
    0x99, 0x05, 0x00, 0x00, GV0(0), GV0(1),     //opInput_Device, GET_TYPEMODE, LAYER_0, PORT_A, TYPE, MODE
    0x99, 0x05, 0x00, 0x01, GV0(2), GV0(3),     //opInput_Device, GET_TYPEMODE, LAYER_0, PORT_B, TYPE, MODE
    0x99, 0x05, 0x00, 0x02, GV0(4), GV0(5),     //opInput_Device, GET_TYPEMODE, LAYER_0, PORT_C, TYPE, MODE
    0x99, 0x05, 0x00, 0x03, GV0(6), GV0(7),     //opInput_Device, GET_TYPEMODE, LAYER_0, PORT_D, TYPE, MODE
    0x99, 0x05, 0x00, 0x10, GV0(8), GV0(9),     //opInput_Device, GET_TYPEMODE, LAYER_0, PORT_1, TYPE, MODE
    0x99, 0x05, 0x00, 0x11, GV0(10), GV0(11),   //opInput_Device, GET_TYPEMODE, LAYER_0, PORT_2, TYPE, MODE
    0x99, 0x05, 0x00, 0x12, GV0(12), GV0(13),   //opInput_Device, GET_TYPEMODE, LAYER_0, PORT_3, TYPE, MODE
    0x99, 0x05, 0x00, 0x13, GV0(14), GV0(15),   //opInput_Device, GET_TYPEMODE, LAYER_0, PORT_4, TYPE, MODE

In return we'll get response i.e.:

13 00 00 00 02 7e 00 7e 00 7e 00 7e 00 08 00 07 00 07 00 7e 00

which stands (based on http://ev3.fantastic.computer/doxygen/types.html)

13 00   //message size = 19 bytes
00 00   //message counter
02      //success
7e 00   //nothing on port A
7e 00   //nothing on port B
7e 00   //nothing on port C
7e 00   //nothing on port D
08 00   //M-MOTOR-DEG on port 1
07 00   //L-MOTOR-DEG on port 2
07 01   //L-MOTOR-ROT on port 3
7e 00   //nothing on port 4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.