The gear trains in many printers and multifunction devices, and in some scanners, have a transfer gear that drives two different gears, depending on which way the drive motor is running. The pictures below show several such transfer gears in the left-side gear train of a Brother MFC-1970MC (1, 2), a 1998-vintage fax/copier/printer/scanner/answering machine multifunction device. The right-side gear train only has half-a-dozen gears in it and isn't shown.
The 1970MC has one drive motor to power four different operations: printer paper pickup, printer paper drive, scan sheet pickup, and scan sheet drive. I suspect that the solenoid (shown in first and last pictures) selects between printer and scanner operation, and that the swinging transfer gears (some of which appear in all pictures) select between paper pickup and paper drive.

Above: When A turns CW (clockwise), D is driven by the transfer gear C. Gears A and C go CW while B and D go CCW. The turning resistance of C causes the arm to swing to the left. When C encounters D, B continues forcing C to the left so that C and D mesh strongly.
Below: When A turns CCW, E is driven by the transfer gear C. Gears A and C go CCW while B and E turn CW.
(Note, there is a one-way clutch or ratchet beneath the black gear E; when E is driven, the white gear beneath E does not turn. When D is driven, it drives the two gears at very top center in picture, so driving the white gear beneath E. Thus E rotates CW whenever A rotates. D rotates CCW when A goes CW. D does not rotate when A goes CCW.)

At the center of the picture above are two swing transfer gears, labeled P and Q. When the solenoid is out (not energized) the hook at the end of arm R prevents Q from swinging. Also, a hook on P (more visible in first photo) slides over end of R so if P is operating Q cannot. When the solenoid is in, Q can swing, and the hook on P hits the end of R, so if Q is operating P cannot engage the gear to its right.