A non-transitory computer readable medium that stores a program, wherein the program causes a computer to execute a method of controlling an electronic apparatus including an adapter connectable to an accessory shoe of a first device, and a plurality of accessory shoes on each of which an accessory is mountable, the accessory being capable of being mounted on the accessory shoe of the first device, the method comprising:
- executing a connection detection process of detecting that an accessory has been mounted on at least one of the plurality of accessory shoes;
- and
- executing a control process of performing communication control to:
- in a case where it is detected that an accessory has been mounted in the connection detection process, transmit, to the first device, information including a type of a mounted accessory which is the accessory mounted on at least any of the plurality of accessory shoes and first port information indicating the accessory shoe on which the mounted accessory is mounted;
- and
- in a case where a communication command to which second port information indicating an accessory shoe to be used for communication is appended is received from the first device, transmit the communication command, from which the second port information is deleted, to the accessory mounted on the accessory shoe indicated by the second port information.