You have, potentially, three options:
- USB to USB (not possible as RPi can only act in Host mode);
- USB to Arduino to GPIO (See below)
- USB to GPIO (See NOTE)
NOTE: If you are going to connect the GPIO to USB then you must
use opto-couplers or voltage levellers, such as the 74HC4050 hex buffer, as USB runs at 5V and the GPIO
is 3V, so without them you would run the risk of frying the RPi
If you use an Arduino (Leonardo, Due or Micro) as an interface then yes. There are Mouse and Keyboard libraries, that allow the Arduino to send key and/or mouse events to the RPi.
If you use an Arduino Pro Mini designed to run at 3.3V then the requirement for opto-couplers or voltage levellers is reduced. On instructables.com is a plan for connecting an Arduino Mini to a RPi, by making a Hoody. I have made this device and it works great.
Once you have built the Hoody, then with the addition of a FTDI to USB interface and the libraries you should be good to go.
The Arduino Pro Mini connected to (and powered by) a SparkFun FTDI
Basic Breakout Board and USB Mini-B cable. Note that on earlier Pro
Mini boards the orientation of the 6-pin header may be reversed; check
that the words GRN and BLK align on the Pro Mini and FTDI Basic
As I have already stated, I built this already - for less than £10, sourcing materials from eBay.
Be careful to note, get a 3.3V Pro Mini, and NOT the 5V, otherwise voltage level shifting and opto-couplers will be required.
ADDENDUM: I am not 100% sure that the Keyboard/Mouse libraries will work with a Pro Mini (as they require 32u4 devices), however, it would be easy enough to write a sketch that fires the appropriate signals to the FTDI.
As David Freitag points out in the comments below, the Pro Micro is compatible with the libraries and also runs at 3.3V and so would make a most suitable choice.
UPDATE: I have just purchased one of these 3.3V Pro Micro clones, from that well known auction site, in order to mess about, emulating mouse clicks.