Note, however, that this is NOT a signal that you want the computer to start running arbitrary software on the drive.
And that USB keyboard has said "hey yes I want to run the software on this drive"?
Another example: the computer: "The user entered 'rm -rf doc', I delete ./doc/", and the user: "I want to get rid of 'Documents/' for the 23rd time today and execute 'rm -rf doc<tab>'".
The discrepancy between "do what I say" and "do what I mean" is part of where security lives. In the above cases, that would be a virus scanner and your favourite *nix command line trash utility, respectively. Other examples can easily be imagined. Just because a user tells you to do something doesn't mean they want you to do it.
All an attacker would have to do is find the ID of a device that you have used in the past.