MacBook Pro 2013 keyboard and trackpad completely freeze The problem

Every once in while the keyboard and trackpad completely stop working and I have no way to affect the software. The mouse pointer is left frozen exactly where it was when the problem occurred and nothing on the keyboard works. The only solution I currently have is to push and hold the power key triggering a forced shut-down - implying keyboard funcitonality, but I'm wondering if this bypass is actually separate from the keyboard processing for the reason I am using it.

I really don't know what this is as it's impossible to diagnose with no interaction tools!

My system


MacBook Pro Retina, 13 inch, Late 2013
Processor 2.4 intel core i5
8gb 1600mhz ddr3
OSX Yosemite 10.10.2


Usage


typical developer machine: ITerm; Sublime; browsers; FileZilla; Slack; MAMP; Sketch
frequently have 30 or 40 Chrome tabs open
ten or so applications in total running at any given time
rarely restart formally, just sleep, I kind of assumed Macs are good at handling this


There are no obvious signs of overload like sluggish responsiveness.

My hunch

Is that it's something to do with overheating, there seems a flaw in the design that means it doesn't handle sitting flat very well (work bought us stands for this purpose) though I haven't noticed a correlation between the fan noise, heat and this event yet.
Try plugging in an external USB device, such as a phone or keyboard. I have found recently that this fixed my intermittent keyboard/trackpad issues perfectly.

As for why this is, I read on another site that the internal keyboard and trackpad on Macbooks connect over USB internally, so if the internal USB hub gets reset, it would force the keyboard and trackpad to reconnect. And after thinking about it, I am pretty certain that any time I have had keyboard/trackpad freezes like yours, I was also plugging in my Android phone, either to charge it or run diagnostics. I am pretty sure that plugging in my phone has been causing these issues.