The Great Linux RNDIS Saga

Having a permenent Linux system around (Ubuntu 9.04, on my netbook for those who haven’t read previous posts) has proved to be quite useful for testing LUFA demos simultaneously against Linux and Windows — and all from the one room. A few days ago – just after the recent 090510 release in fact – I started to retest some of the LUFA demos I’d missed. And as luck would have it, I discovered some bugs in the Dual CDC and RNDIS demos. Damn you Murphy!

The issues were identical; I’d missed changing the demos’ control packet handling events over to the new global USB_ControlRequest structure instead of trying to read out the remainder of the control request header at the start of the packet, as was the norm in previous releases. The new global structure is populated by the library internally when the control request is first handled by the library (if possible), and serves to give a unified control header access method between both device and host modes. Fixing those faults were easy, but it was too late for the already released 090510 version. If you’re planning on using either of those demos, grab the latest version from the SVN rather than use the release code.
However, the RNDIS demo remained unhappy on Linux. I’ve tested the (working) RNDIS demo before on Ubuntu 7.10 and 8.04 to little success, but that was perfectly understandable given that the RNDIS class is a Microsoft proprietary standard – and a poor one at that – and the RNDIS handling code wasn’t yet mature. When I first started I had to choose between several evils; either go with the Microsoft RNDIS demo and shut out at the time other OSes, or use the standard CDC Ethernet class which Windows didn’t support. Going by the “support in numbers” philosophy I ultimately ended up implementing RNDIS hoping correctly that it was inevitable that it be incorporated into Linux at some stage.

However, with the new 9.04 release of Ubuntu, containing more mature RNDIS code, I decided it was time to get the demo working under it. Plugging it in got me a fat lot of nothing, although a dmesg showed a few RNDIS related enumeration errors. The error was in the RNDIS request for the “0x00010202” property, and a quick Google search showed this was a common error.

The Microsoft documentation stated that the 0x00010202 property mapped to OID_GEN_PHYSICAL_MEDIUM, which lets the device indicate to the host what sort of physical medium (Ethernet, WIFI, etc.) the adapter incorporates. Linux wasn’t/isn’t happy about this property not being implemented, even though it is clearly identified as being an optional property.
Not to worry; I simply implemented the property, returning a value of 0 (meaning media unspecified) to the host, and suddenly Linux was happy and everything worked well. I thought it was worth trying to dig up the relevant code and design a patch around it, but it seems I’ve been beated to the punch. The only oddity there is that the patch was supposedly put into the 2.6.26 mainline code, yet on both the Ubuntu 9.04 kernel (2.6.28) and a generic 2.6.30 kernel I tried the same issues cropped up. Either the patch hasn’t be applied upstream, or the patch writer has made an error. I’d love for someone to be able to comment on this further.

On a related note, I tried to make my main laptop dual boot Vista and Ubuntu yesterday, with no success. I’ve tried Ubuntu previously on my laptop and that was disaterous, with it going into thermal shutdown from the Kernel being unable to control the ACPI fan on the motherboard. Trying the latest Ubuntu release gives an instant kernel panic about the wonky BIOS’ ACPI before the bootsplash has even shown. It seems Toshiba really can’t write a decent BIOS…

 

Comments: 7

Leave a reply »

 
 
 

hi..
do you have any picture from avr silicon that show ram, rom, flash & other parts of controller?
do you know how we can erase lock bit without erease flash programs?
thanks

 

No, I don’t. Don’t steal others’ firmware.

 

Dean,
It’s not necessarily stealing someone else’s firmware.. What if you want to write a driver that the vendor hasn’t provided?
Unfortunately, due to ignorant vendors, the freedom of software depends on reverse engineering..

Mahdi: The usual way of doing this afaik is to find a security hole in the firmware, usually by buffer overflow or such, that causes it to regurgitate its flash or sram contents down the USB.. If the program is well written then it’s usually very difficult to read firmware protected by a lock bit, unfortunately.

 

Vista and Windows 7 support CDC Ethernet…

Michael Purwoadi
 

I plug in a smartphone LG KS-20 to my notebook with Ubuntu 9.04 and activate internet-sharing feature in the smartphone.
In the past time, it will give me HDSPA connection and an IP ver 4 in my notebook. Since a week, it gives only IP ver 6 to
my notebook, unfortunately, neither change the routing table.
Now I lost my internet connection while travelling.

Unfortunately, it still work with my other notebook that uses MS Windows 7 through bluetooth connection.

Is this related to RNDIS thing in Ubuntu 9.04 ? When connected, Ubuntu often ask for automatic update or something.

Regards,
Michael

 

Michael,

I’m not an expert on the RNDIS implementation in Linux, but it could well be a broken update to the RNDIS or networking drivers. Unfortunately I can’t give any advice on how to fix it, short of manually downgrading all the packages.

– Dean

 

Leave a Reply

 
(will not be published)
 
 
Comment
 
 

 

Vital Stats

  • 35 Years Old
  • Australian
  • Lover of embedded systems
  • Firmware engineer
  • Self-Proclaimed Geek

Latest Blog Posts

RSS