Indeed, firing at charge would be completely ineffective... The rifle/muskets most cavalrymen had was needed after : for example if they were dismounted to defend themselves against another cavalryman. As Duuring said it was used for the scouting duty, for example if they have to dismount and explore houses in a village.
Yes, I have done some research into the topic and I have found out that yes, cavalry did use firearms for what you mentioned, attacking/ searching villages and for covering retreats or skirmishes. Each squad of cavalry on the battlefield would have a small unit of flankers (which was the term I found used) carried firearms and were deployed at either the top or the bottom of the column or line so they could cover a retreat whilst the main body of the cavalry falls back or skirmish. Flanker/flanquer basically means skirmisher