I'm not sure I know what you want to achieve but jockey-text
will let you detect and install drivers from the command line.
It has various arguments where you'd be able to parse the output and feed them back into it via a script. Just look at jockey-text --help
If you need to really play around with how it works, it's all Python (with a light dusting of dbus) so you're free to just dive in and hack around with whatever you want.
You can find the scripts in /usr/lib/python2.6/dist-packages/jockey/
(this path will change in future Ubuntu versions when there's a different Python version being used) and you can see how jockey-text
interfaces with this in its own script here: /usr/bin/jockey-text
.
I'd suggest inheriting jockey.ui.AbstractUI
like jockey-text
does and working it from there. It's not a simple application though. It's going to take a bit of time to figure out what's actually happening inside that class before you can meaningfully use it.