The Great Patent Give-away

Has the world gone crazy? Are companies spending millions on R&D, tens of thousands on patent protection and just giving it all away? Tesla, Ford, Toyota - all have attracted headlines along the lines of "Company X opens up patent portfolio" or "Company Y gives away patents". But what's really going on?