ev3dev / ev3dev

ev3dev meta - bug tracking, wiki and releases
http://www.ev3dev.org
GNU General Public License v2.0
636 stars 85 forks source link

"USB Device Not Recognized" on boot #43

Closed G33kDude closed 10 years ago

G33kDude commented 10 years ago

Whenever I boot the EV3 with the USB cable plugged in (usually because I ran the reboot command), it gives me this error traytip, and I can't connect to it until I physically reattach the cable.

USB Device Not Recognized
One of the USB devices attached to this computer has
malfunctioned, and Windows does not recognize it.
For assistance in solving this problem, click this
message.
rhempel commented 10 years ago

Stop using Windows? :-)

G33kDude commented 10 years ago

Case closed. It's because my OS is inherently at fault. But seriously, what's the issue here? I was hoping it would be a simple fix, something along the lines of moving the USB initiation further along in the boot process.

rhempel commented 10 years ago

I was being a bit flippant in my answer - sorry.

I set up the RNDIS driver as the last thing that happens before the login prompt. When in the boot cycle does the error appear in Windows? And are you sure the error does not happen as a result of the USB device going away during the EV3 reboot?

G33kDude commented 10 years ago

It occurs even if it's a cold boot, several hours since it has disconnected, and the cable was removed. It usually occurs about half-way through the boot sequence, long before the LEDs turn green. I'm running windows 7 professional, and will test it out on my XP computer in just a few minutes.

G33kDude commented 10 years ago

Same problem on the XP computer. It's just about a full minute before the green LEDs that windows reports a usb malfunction.

jsvalderrama commented 10 years ago

setting usb network

Hello, I have an issue setting up USB Ethernet Networking on windows 7 Professional. I have followed all the steps setting up the SD card. Uncomment this line export EV3_GADGET="g_ether" on the ev3dev.rc.local file. I have started my EV3 and logged on it through an USB Keyboard directly connected on the EV3, but when I plug the brick on my windows7 laptop, the device detected is an USB port. I have tried several things to change it and update with the RNDIS drivers but nothing works. Could you please advise me in this matter? Please note thats my OS is in french. Thanks in advance.

dlech commented 10 years ago

I think I have figured it out. There seems to be a problem with the way that the device is initialized when using /etc/network/interfaces. In that file, you may have section that starts with:

auto usb0
...

Delete that whole section and save the file. If it is not there, then just do this next part.

Then, create a new file named /etc/udev/rules.d/50-g_ether.rules with the following contents:

KERNEL=="usb0", KERNELS=="gadget", RUN+="/sbin/ifconfig usb0 192.168.3.1"

Let me know if it works for you.

dlech commented 10 years ago

Perhaps I spoke too soon. It was working but now I seem to have the same problem as above again. Back to the drawing board. You can still try my suggestion if you like.

jsvalderrama commented 10 years ago

Hello David, I followed all your advises on the file /etc/network/interfaces and no USB was mentioned. Then I created the file 50-g_ether.rule on the directory /etc/udev/rules.d/, but no progress. I still have the issue and I am not seeing any RNDIS devices. Thanks for your Help Best regards,

dlech commented 10 years ago

I thought that may be the case. There seems to be an issue with the USB driver that it does not notify that it has changed the connection type from b_idle to b_peripheral. You can work around this by removing and adding the g_ether module.

modprobe -r g_ether && modprobe g_ether

Of course if USB is the only way you have to connect to the EV3, you are out of luck for now.

If anyone wants to try having a look at the driver before I get to it, say so and I can point you in the right direction.

dlech commented 10 years ago

@jsvalderrama

If you disconnect and reconnect the USB cable, Windows should detect the correct USB connection type. If not, make sure that you followed the instructions.

dlech commented 10 years ago

OK, I was just reviewing and it is obvious that you have followed the instructions :smile:

jsvalderrama commented 10 years ago

hello David, i just tried to connect the EV3 on my mac and followed the instructions below: https://github.com/mindboards/ev3dev/wiki/Setting-Up-OSX-USB-Ethernet-Networking Nevertheless, i can't get the same result I do when I am on on windows. There is no usb device as you announce on your documentation. Either on windows or mac I have not been able to make the EV3 work. can you please tell me what change since this instruction have been posted ? i m trying this on maverick please advice

Thanks

2014-03-14 18:39 GMT+01:00 David Lechner notifications@github.com:

OK, I was just reviewing and it is obvious that you have followed the instructions [image: :smile:]

Reply to this email directly or view it on GitHubhttps://github.com/mindboards/ev3dev/issues/43#issuecomment-37675249 .

dlech commented 10 years ago

It sounds like the g_ether (for Windows) or g_cdc (for Mac) module is not running. Check the ev3dev.rc.local file on your SD card and make sure you have removed the appropriate comment like this.

If you don't have another way to connect to the brick, you can plug a keyboard into the EV3 and log in and run lsmod | grep "g_" to make sure that one (and only one) of the modules are running.

jsvalderrama commented 10 years ago

Hello, I found out why the ev3dev.rc.local was not loading on every system : there was a missing part on the script /etc/rc.local. The line in red is the one that I have added and now it should work for every system. I have tested it and the driver is loading now

/etc/rc.local If there's a file called ev3dev.rc.local on the FAT32 partition, run it if [ -e /media/mmc_p1/ev3dev.rc.local ]; then echo "Executing /media/mmc_p1/ev3dev.rc.local" /media/mmc_p1/ev3dev.rc.local <========== part missing fi

regards

rhempel commented 10 years ago

I'm pretty sure that was fixed in this release

jsvalderrama commented 10 years ago

I just downloaded again this release (Release 00.01.01 of the ev3dev.img file) through this link "https://github.com/mindboards/ev3dev/releases/download/v00.01.01/ev3dev.img.gz" to make sure it was not me and I confirme that the part is missing to exectute the script

It seems there is another issue with the ev3dev.rc.local file because after retrieving the new image and making the modification, the file does not load either. I tried to launch the script manually and here is the error that I have: /ev3dev.rc.local: line 2: $'\r': command not found ./ev3dev.rc.local: line 5: $'\r': command not found ./ev3dev.rc.local: line 8: $'\r': command not found not found.le g_ether ./ev3dev.rc.local: line 10: $'\r': command not found Sleeping for a couple of seconds to let things settle down... ./ev3dev.rc.local: line 12: $'\r': command not found

Please note that I haven’t opened the script on Windows but directly on Linux from the EV3 console with nano and that I have modified so it should not be corrupted.

Could you please tell me if you have the same behavior? Thanks

cavenel commented 10 years ago

I think you are missing something here jsvalderrama. I downloaded "https://github.com/mindboards/ev3dev/releases/download/v00.01.01/ev3dev.img.gz" as well, and I have: if [ -e /media/mmc_p1/ev3dev.rc.local ]; then echo "Executing /media/mmc_p1/ev3dev.rc.local" . /media/mmc_p1/ev3dev.rc.local fi and everything is working perfectly.

rhempel commented 10 years ago

Thanks for confirming this!

jsvalderrama commented 10 years ago

Hello

I followed the link and downloaded the image. I confirme that this time the line is on the script as you mentionned, but I still have all the errors when I launch it; for example, see the my screen capt: capt After having executed the modporbe g_ether command and setting up the Ip adress to be able to connect on putty, I’m trying to lauch the . /media/mmc_p1/ev3dev.rc.local and you will see the result

I am using Image Writer for Microsoft Windows Release 0.7 to create my sd cards, so you are right if you are able to make it work without any issue but something is missing on my process, but I don’t see what. I have tried many ways to modify the eve3dev.rc.local but each time the file didn’t load up. The only way I found to make it work is to rewrite it manually and take 2 lines, the one I need for Windows and Linux and the one of the IFconfig I appreciate the help you can provide me on this matter. Best regards,

cavenel commented 10 years ago

@rhempel I am the one thanking you for all this awesome work you are doing so that we can have fun :)

@jsvalderrama It really looks like your file as been saved under Windows at least once. Most of Windows editors add this \r at the end of each lines (dos end lines are \n\r -- carriage return + Line Feed -- while unix end lines are only \n) There is a unix tool called dos2unix that can convert \n\r to \n. So just do: dos2unix /media/mmc_p1/ev3dev.rc.local /media/mmc_p1/ev3dev.rc.local and the ev3dev.rc.local should work again. You can also use some Windows text editor that can save / edit Unix text files (like EditPad Lite I think: http://www.editpadlite.com/ )

Best,

WasabiFan commented 10 years ago

@cavenel I'd recommend using Notepad++ to edit the file. It preserves the line endings of files that you open and you can remove unwanted endings with the find/replace window's extended mode. If the problem is line endings from a Windows editor, N++ is your best bet. It was the only editor that I had that didn't corrupt it when I tried.

rhempel commented 10 years ago

Thanks for the diagnosis @cavenel - it does look like the line endings have been messed up under a Windows editor. If I edit under Windows, I use gvim, but any decent programmer's editor (ie not stock Notepad) will preserve line endings properly.

And please, lately @dlechner has been doing most of the heavy lifting!

jsvalderrama commented 10 years ago

Hello, Thank you all for your answers and help that you have provided me. The Notepad ++ and dosunix fixe my issue and now I can focus on other Topics. I just wanted to let you know that I have succeeded making work my differents USB devices as Wireless N USB Adapter TL-WN821N and, the most important, my telosb sensor can communicate with the Robot and your Customize OS

dlech commented 10 years ago

I finally found the root cause of this. The USB port is technically an USB OTG port, which means that it is capable of being a host port or emulating a peripheral. I read up on the USB specs on this and it is now apparent to me that LEGO wired the port to be peripheral only. We are not going to be able to use host mode on this port without modifying the hardware (however, there are solder pads in the right places if anyone really want to do this). As a result, I have told the musb driver that we are peripheral only and that made it quit doing whatever was causing the error.

G33kDude commented 10 years ago

Great! Now to get motor drivers working and this will be my distro of choice

Any ETA on the motors? They're the only thing preventing me from using this distro all the time

WasabiFan commented 10 years ago

@G33kDude I think they are ready. Are you using the release that @dlech made recently? I think it's in there.

dlech commented 10 years ago

Yup. I just uploaded a new image that includes the fix for this issue as well as the latest motor drivers from Ralph (which were in the last test image as well).

See this page for docs.

G33kDude commented 10 years ago

Shoot, I just reformatted my card three hours ago. Time to download a third image file!

Edit: Oooh, great! It has the dns server already defined! Python is properly aliased as well now! This is the best release yet