A device including: a remote power console having a controller; a shaft having a proximal end and a distal end and comprising an elongated outer sheath, first and second rotatable drive shafts (30, 32) disposed within the outer sheath, each rotatable drive shaft having two tabs (20801, 20802) extending from a quadrature ring mounted on the rotatable shaft, the two tabs extending radially from and configured to rotate with the rotatable drive shaft, two light sources arranged approximately 90 degrees from each other relative to an axis of rotation of the first rotatable drive shaft, the light sources being mounted within the outer sheath at a distal end of the shaft, and two light sources arranged approximately 90 degrees from each other relative to an axis of rotation of the second rotatable drive shaft, the light sources being mounted within the outer sheath at a distal end of the shaft, and a fiber optic cable set for transmitting the light from the light sources along the length of the flexible shafts to the controller of the power console, wherein, upon rotation of a said rotatable drive shafts, the two tabs of each rotatable drive shaft alternately block and allow light from each of the respectively two light sources to reach the remote power console and, based on receipt by the remote power console of the light emitted from the respective light sources, the angular position within one-quarter revolution increments and the rotational direction of the rotatable drive shaft can be determined; and a surgical attachment having an anvil and a staple driver/cutter configured to be driven by the first and second drive shafts respectively; wherein the quadrature rings are disposed within a coupling detachably attached to the surgical attachment; and the controller is configured to track the angular position and rotational direction of each rotational drive shaft based on the output signal from the quadrature ring, and determine a relative displacement of the anvil with respect to the staple driver/cutter. a remote power console having a controller; a shaft having a proximal end and a distal end and comprising an elongated outer sheath, first and second rotatable drive shafts (30, 32) disposed within the outer sheath, each rotatable drive shaft having two tabs (20801, 20802) extending from a quadrature ring mounted on the rotatable shaft, the two tabs extending radially from and configured to rotate with the rotatable drive shaft, two light sources arranged approximately 90 degrees from each other relative to an axis of rotation of the first rotatable drive shaft, the light sources being mounted within the outer sheath at a distal end of the shaft, and two light sources arranged approximately 90 degrees from each other relative to an axis of rotation of the second rotatable drive shaft, the light sources being mounted within the outer sheath at a distal end of the shaft, and a fiber optic cable set for transmitting the light from the light sources along the length of the flexible shafts to the controller of the power console, wherein, upon rotation of a said rotatable drive shafts, the two tabs of each rotatable drive shaft alternately block and allow light from each of the respectively two light sources to reach the remote power console and, based on receipt by the remote power console of the light emitted from the respective light sources, the angular position within one-quarter revolution increments and the rotational direction of the rotatable drive shaft can be determined; and a surgical attachment having an anvil and a staple driver/cutter configured to be driven by the first and second drive shafts respectively; wherein the quadrature rings are disposed within a coupling detachably attached to the surgical attachment; and the controller is configured to track the angular position and rotational direction of each rotational drive shaft based on the output signal from the quadrature ring, and determine a relative displacement of the anvil with respect to the staple driver/cutter. a surgical attachment having an anvil and a staple driver/cutter configured to be driven by the first and second drive shafts respectively; wherein the quadrature rings are disposed within a coupling detachably attached to the surgical attachment; and the controller is configured to track the angular position and rotational direction of each rotational drive shaft based on the output signal from the quadrature ring, and determine a relative displacement of the anvil with respect to the staple driver/cutter.