"Barking up" this originated with hunting; a dog would sometimes make a mistake locating its prey
It was of a long-limbed hound, one of those 'fine, hunting dogs' the classical... [DOC] [TLE] Idioms and Expressions - Pima County Fair [PAR] different wayssometimes sensibly and sometimes arbitrarilysometimes 
ignorantly and sometimes ..... their hunting skill, so, nowadays, we can say 
someone.