I've been using my HP w2207 flat panel monitor for some time now. My only frustration has been that I haven't been able to get the USB ports on the side to work unless I have a device plugged in when the computer boots. I think this is more the fault of Ubuntu than it is the monitor. Ubuntu just doesn't seem to care about a USB hub unless there is a device plugged into it. After a little searching on the web I found that a fellow blogger had posted a solution on Hack 2 Live.
Since my wife also uses this computer and she's not nearly as geeky as me, I figured I had better make this a little more automatic. The first step was to write a script to automate the USB restart. Copy the following text into a text editor and save it as /home/userid/bin/usb_reset.
#!/bin/bash## Script *usb_reset*. Place file in ~/bin. Make sure to make executable with "chmod +x usb_reset".# This script must be run as root to work. For desktop launcher, use command "gksudo /home/userid/bin/usb_reset". # Stop USB modprobe -r ehci_hcd wait # Start USB modprobe ehci_hcd exit 0
Now make the file executable. Open a terminal and enter the following commands.
chmod +x usb_reset
You can now try out the script with
If you had a USB drive connected to your hub, then it should have been recognized and mounted automatically.
Now we just need to create the button for our Gnome panel. Right click on the panel and select Add to Panel. Select Custom Application Launcher and click Add. Now in the Create Launcher window enter into the name field
and enter into the command field:
The USB icon should get selected automatically. Click OK.
That's it! You can now restart your USB devices with the click of a button. You will need to enter your password at the prompt if you haven't done any sudo commands recently.
#
One problem: I need permissions to save a file to /bin .
How do I save to bin? Maybe using sudo?
Also, maybe rewrite for newer versions of Ubuntu? I wouldn't have scrolled down to see your changes except for my permissions problem. And it's still unwieldy to try to replace the script as you indicate.
Dan
#
Oh, I have 11.04 Natty.
I just tried cutting & pasting your text into a terminal screen replacing "ehci_hcd" with "usb_storage." I got this:
modprobe -r usb_storage
FATAL: Error removing usb_storage (/lib/modules/2.6.38-11-generic-pae/kernel/drivers/usb/storage/usb-storage.ko): Operation not permitted
So much for that.
#
You need to use sudo.
#
Yes, you could use sudo to put it into /bin if you want it available from all accounts on the machine, (assuming they have sudo privilege). I put it in a personal bin folder, ie: /home/linerd/bin/
#
Hi Linerd, thanks for the script.
Do you see any reason why it wouldn't work in Fedora?
#
It should work as long as you're unloading and reloading the correct kernel modules. I'm not a Fedora user, so I'm not sure how different things are. Ubuntu has since changed to using the usb_storage kernel module.
#
I tried this on Ultimate Linux 2.7, which is Ubuntu 10.4 on steroids.
Unfortunately, all that happens is that I click the icon I placed in the taskbar, and the Power Options clickable icon shows. But, no matter which option I click, nothing happens. Some change in Gnome, I guess.
#
Frank, I should have posted a link to a newer post, but even that one doesn't work with 10.04. Sure enough, there was a change. The kernel module is now called usb_storage. I also just realized that the formatting of the script got screwed up and the commands were listed right after the comments. I've fixed the formatting of this post.
Take this corrected version of the script above and replace ehci_hcd with usb_storage in both places. It should now work with 10.04.
The USB icon doesn't get selected automatically any more either. The one I like is /usr/share/icons/hicolor/48x48/apps/gdu-category-peripheral.png.