2014. május 7., szerda

Windows 8.1 vs Microchip CDC

And the winner is...
Me. :-)
After I was able to reanimate the FRDM-KE06Z board, I started to work with the robot.
With three days of struggling I drilled trough the Freescale's not to clever driver mess, the CodeWarrior's badly installing sample, and my errors.
As the result the PWM motor driving works.
I started to think what would be the continuation. One option is creating the classical "line follower" robot - I have not to much lust for this, but I'll install the sensor for sure.
Beside of this I've infinite number of ideas, but one thing is really iching in my mind. This freedom board has infrared transciever. This can be used for various things.
Like proximity sensor or IR remote receiver.
Finally I decided to work on the second one.
To have a clue about the code I should write, picked two equipment from my drawer:
A mini remote from DealeXtreme (this will be the remote control of the robot)


The IR Toy by dangerousprototypes (I want to use this to see the frequencies and wave patterns)


I picked th IR Toy, connected to my PC and...
So the article starts here.
The IR Toy was not recognized by the machine.
I started to investigate. The driver reside in the firmware upgrade package. Downloaded it.
It said that the driver is not signed for this OS therefore not installed it.
I remembered from somewhere, that exists a USB installer tool for this kind of equipment. Searched for it, downloaded it. We are talking about the Zadig WinUSB. I installed the IR Toy with it. Everything fine just I didn't got serial port.
Back to the roots. Started to search how can I generate a .cat file suitable for Windows 8.1 from the existing .inf file. The compliance of the driver (usbser.sys) itself is not in question since it is part of the operating system, just I need an .inf file what able to associate the Vendor/Product ID to this
I found the program called inf2cat.exe. It is part of the Windows WDK.
Installed a version 8 WDK and an 8.1 update for it.
Run Inf2cat:
"C:\Program Files (x86)\Windows Kits\8.1\bin\x86\Inf2Cat.exe" /drv:<inf path> /os:7_X86,7_X64,8_X86,8_X64,6_3_X86,6_3_X64
No success.
The result: 1 error, 2 warning
Error: the driver date in the file is too old for the new operating systems
Warning: the mentioned driver is not on the source list.
I changed the date (and the version), the warnings are natural because the driver in question is part of the OS.
Inf2cat once more. Runs, I got my .cat file.
Driver install. I got some unknown error.
Investigation further. I found that the foundation of the problem is the driver signing policy of the Windows 8/8.1, what doesn't allow the unsigned drivers. Here was my misunderstanding. Not just the binary driver but the .inf file requires a signing.
There are two options left:
  • Switch of the policy for the installation
  • Sign the driver (to be precise - the .cat file)
Choose the harder way.
I started to work according to this document, but simplified it:
http://technet.microsoft.com/en-us/library/dd919238(v=WS.10).aspx
I've an enterprise root ca, so I hadn't deal with the trusted root.
First of all we need a Code Signing certificate.
1. Installed the Code Signing template to the CA because it wasn't there.
2. Requested a certificate from the certificates mmc (for my account)
3. Exported the certificate to a file (the private key not required)
4. Imported the certificate into the Trusted Publishers store  (machine account)
Let's sign it
5. With the SignTool and with /a switch (It find the certificate automatically, I don't need the timestamp now. Just the driver will stop to work at the expiry of the certificate) signed the .cat file:
"C:\Program Files (x86)\Windows Kits\8.1\bin\x86\signtool.exe" sign /a mchpcdc.cat
Driver Install...
It installed, I've a serial port.
P.S.: I've an idea. It will be usefull to build a webpage what is able to create a signed driver from a template with it's own ca to anyone, and just asks the Vendor/Product ID as input.

1 megjegyzés: