Firefly luminescence is an intriguing phenomenon with potential technological applications, whose biochemistry background was only recently established. The physics side of this phenomenon, however, was still unclear, specifically as far as the oxygen supply mechanism for light flashing is concerned. This uncertainty is due to the complex microscopic structure of the tracheal system: without fully knowing its geometry, one cannot reliably test the proposed mechanisms. We solved this problem using synchrotron phase contrast microtomography and transmission x-ray microscopy, finding that the oxygen consumption corresponding to mitochondria functions exceeds the maximum rate of oxygen diffusion from the tracheal system to the photocytes. Furthermore, the flashing mechanism uses a large portion of this maximum rate. Thus, the flashing control requires passivation of the mitochondria functions, e.g., by nitric oxide, and switching of the oxygen supply from them to photoluminescence.