Tuesday, 22 November 2016

How to Fix Moto G MTP not working on Windows 10


OMG.

After spending two hours and a long uncomfortable call with Motorola that went nowhere, I finally managed to get MTP working on my new Moto G 4 phone.

Effectively, when I set the phone to MTP mode, the driver failed to load. I could run as PTP, but that didn't give me access to the whole FS...

Device manager told me that the install was incomplete due to a bad inf,

"a service installation section in this INF is invalid"


The advice on the internet was 
  • update the driver
  • reinstall the driver
  • turn it off and on again

and a variety of other shamanistic advice, none of which work.

Motorola's advice was to run their Device Manager to reinstall the drivers, but of course, that tool didn't recognize the device being there so... and then the advice was to call Microsoft support.  Sigh.

I found the solution myself. For whatever reason, the PNP tools were not actually getting to install the right INF, even when I selected it via "legacy hardware", likely because some other config was getting hit first.

If you have the same issue, simply do this.
  • Run an administrator cmd shell
  • cd to \windows\inf
C:\Windows\INF>pnputil /?
Microsoft PnP Utility

PNPUTIL [/add-driver <...> | /delete-driver <...> |
         /export-driver <...> | /enum-drivers | /?]

Commands:

  /add-driver <filename.inf | *.inf> [/subdirs] [/install]

    Add driver package(s) into the driver store.
      /subdirs - traverse sub directories for driver packages.
      /install - install/update drivers on any matching devices.

  /delete-driver <oem#.inf> [/force]

    Delete driver package from the driver store.
      /force - delete driver package even when it is in use by devices.

  /export-driver <oem#.inf | *> <target directory>

    Export driver package(s) from the driver store into a target directory.

  /enum-drivers

    Enumerate all 3rd party driver packages in the driver store.

  /?

    Show this usage screen.

Legacy Commands:

  [-i] -a <filename.inf> ==> /add-driver <filename.inf> [/install]
  [-f] -d <oem#.inf>     ==> /delete-driver <oem#.inf> [/force]
  -e                     ==> /enum-drivers

Examples:

  pnputil /add-driver x:\driver.inf       <- Add driver package
  pnputil /add-driver c:\oem\*.inf        <- Add multiple driver packages
  pnputil /add-driver device.inf /install <- Add and install driver package
  pnputil /enum-drivers                   <- Enumerate OEM driver packages
  pnputil /delete-driver oem0.inf         <- Delete driver package
  pnputil /delete-driver oem1.inf /force  <- Force delete driver package
  pnputil /export-driver oem6.inf .       <- Export driver package
  pnputil /export-driver * c:\backup      <- Export all driver packages


C:\Windows\INF>pnputil /add-driver wpdmtp.inf /install
Microsoft PnP Utility

Adding driver package:  wpdmtp.inf
Driver package added successfully.
Published Name:         wpdmtp.inf
Driver package matches devices that already have their drivers up to date.

Total driver packages:  1
Added driver packages:  0

C:\Windows\INF>

Tuesday, 13 September 2016

Geek Dad: Teaching the boy to code...

I might have finally gotten my sons attention.  I've been trying to teach him to code in Java for a couple years, but I am competing with the instant gratification of Scratch.

First attempt went something like this: "Hey dude, look how you can use state machines and state transition diagrams to write a text adventure like Zork!" He was kind of interested in building the map, but I lost him in implementing an actual game complete with inventory and actions.

Next attempt was: "Hey son, remember Wizard's Quest the board game I showed you? We can write that as multiplayer network game (kind of like Dark Forest when I was a kid)." He learned something about polygons and translation from the game board into the computer, but I lost him in implementing the event loop and game rules.

Finally we have: "Dude, when I was 8, I played this game called Chase on a Data General Nova III, and it was cool because like in Tron, you could maneuver the robots chasing you into the walls and escape the grid!" I think I got him this time, because I was able to spin up a framework in a few hours, and the building blocks are all there for adding animation, time/event based movement, and other elements.  Almost instant gratification in a couple pages of code.

The Grid



The rules.  You are in an arena with electric fences and robots. The robots can only move horizontally or vertically, but you can move diagonally. The objective is to run away from the robots and attempt to maneuver them into the walls.  You win when all the robots are dead. You loose when you run into a wall, a robot gets you, or you exceed 100 moves.

Robots use the difference between their position and your position when deciding to move vertically or horizontally (50-50). If another robot is in the way, they pick a random direction (that can cause them to bump into another robot or wall). Whatever a robot runs into is destroyed, but when one robot hits another, one survives.

The Tron Maneuver


Friday, 22 April 2016

I Turned my Pi into an Echo (not quite)

Being sick with a head cold, I took a few hours to play with the Pi and do something Alexa like.  I've been trying to get an Alexa project in - but time isn't my friend at this time.

https://github.com/amzn/alexa-avs-raspberry-pi

Installing everything I needed on the Pi took a couple hours.  It, for the most part, went without a hitch.  However, there are some things that irritate me.

The instruction on getting tightvncserver persisted doesn't work for me.  For whatever reason, I need to start it each time I boot my Pi, (and also I did not set the maven environment variables in a startup script, so I need to do this every time I make a shell).

The java installer script is broken.  lsb was not installed on my Pi.  I went to get it, and then though it is Wheezy, the version code wrong.  So - comment out the first few lines to check the version and I updated Java okay.

The AYL speaker I bought makes a TON of noise when the USB power is plugged into the Pi.  I figure its drawing too much amperage given the connection I had to the USB on the computer I use.  I didn't retry it on a wall charger.

Even though I said yes to Amazon Music, I gather their is a permission step from Amazon they might not be willing to grant for hackers such as myself - even though I have Prime and active Amazon Music subscription!  Grrr.

But at least now I have a base to play with.  The companion server (node js) and the sample java client both work as documented.  Note, you do not need a wake word, just give the command once you click the start button.