<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Digivation Hack Central &#187; device driver</title>
	<atom:link href="http://blog.digivation.com.au/category/tag/device-driver/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.digivation.com.au</link>
	<description>Tech Information about various subjects</description>
	<lastBuildDate>Sat, 17 Sep 2011 02:57:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.2</generator>
		<item>
		<title>Mapping special names to multiple USB serial adapters</title>
		<link>http://blog.digivation.com.au/category/solar/mapping-special-names-to-multiple-usb-serial-adapters</link>
		<comments>http://blog.digivation.com.au/category/solar/mapping-special-names-to-multiple-usb-serial-adapters#comments</comments>
		<pubDate>Fri, 16 Apr 2010 15:34:59 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Solar]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[current cost]]></category>
		<category><![CDATA[currentcost]]></category>
		<category><![CDATA[device driver]]></category>
		<category><![CDATA[envi]]></category>
		<category><![CDATA[gci]]></category>
		<category><![CDATA[mains power monitor]]></category>
		<category><![CDATA[serial]]></category>
		<category><![CDATA[udev]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[watts clever]]></category>

		<guid isPermaLink="false">http://blog.digivation.com.au/?p=125</guid>
		<description><![CDATA[The watts clever envi has a USB serial adapter which is a Prolific pl2303. When inserted it is assigned /dev/ttyUSB0 by udev, among a few other symlinks. I have now obtained an RS485 serial adapter on ebay for A$13.98 delivered which uses the exact same chip, which makes it indistiguishable from the envi&#8217;s port. What [...]]]></description>
			<content:encoded><![CDATA[<p>The watts clever envi has a USB serial adapter which is a Prolific pl2303. When inserted it is assigned /dev/ttyUSB0 by udev, among a few other symlinks. I have now obtained an RS485 serial adapter on ebay for A$13.98 delivered which uses the exact same chip, which makes it indistiguishable from the envi&#8217;s port. What I needed was a way to guarantee uniqueness regardless of the enumeration order on boot or random hot plugin. Naturally, this is for the Aurora GCI which will be installed when they become available in May.</p>
<p>Researching udev a bit, I found /lib/udev/rules.d/60-persistent-serial.rules (mine is a debian system). This file shows how the standard symlinks are done. Since each USB port is unique, I should be able to use that uniqueness to map another symlink to the device.</p>
<p>Firstly plug in the device in the chosen USB port and issue<br />
<code>udevadm info --query=all --name=/dev/ttyUSB1</code></p>
<p>This shows a heap of stuff but mainly we are interested in<br />
<code>P: /devices/pci0000:00/0000:00:1a.0/usb2/2-1/2-1:1.0/ttyUSB1/tty/ttyUSB1</code></p>
<p>Create a file in <code>/etc/udev/rules.d/70-persistent-serial.rules</code> which contains</p>
<blockquote><p>
#see /lib/udev/rules.d/60-persistent-serial.rules</p>
<p>ACTION!=&#8221;add|change&#8221;, GOTO=&#8221;persistent_serial_end&#8221;<br />
SUBSYSTEM!=&#8221;tty&#8221;, GOTO=&#8221;persistent_serial_end&#8221;<br />
KERNEL!=&#8221;ttyUSB[0-9]*|ttyACM[0-9]*&#8221;, GOTO=&#8221;persistent_serial_end&#8221;</p>
<p>IMPORT=&#8221;usb_id &#8211;export %p&#8221;<br />
#IMPORT=&#8221;path_id %p&#8221;</p>
<p>ENV{ID_SERIAL}==&#8221;", GOTO=&#8221;persistent_serial_end&#8221;</p>
<p># usb nearest ethernet connector<br />
ENV{DEVPATH}==&#8221;*usb2/2-2/2-2:1.0*&#8221;, SYMLINK+=&#8221;serial/by-name/envi&#8221;<br />
#bottom front connector<br />
ENV{DEVPATH}==&#8221;*usb7/7-1/7-1:1.0*&#8221;, SYMLINK+=&#8221;serial/by-name/rs485&#8243;<br />
# usb below nearest ethernet connector<br />
ENV{DEVPATH}==&#8221;*usb2/2-1/2-1:1.0*&#8221;, SYMLINK+=&#8221;serial/by-name/rs485&#8243;</p>
<p>LABEL=&#8221;persistent_serial_end&#8221;
</p></blockquote>
<p>Replug and voila you get <code>/dev/serial/by-name/rs485</code> which will always be the correct device.</p>
<p>Now I just have to run the wire to where the GCI will be installed.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.digivation.com.au/category/solar/mapping-special-names-to-multiple-usb-serial-adapters/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using WinCE5.0 drivers on WinCE4.2</title>
		<link>http://blog.digivation.com.au/category/nifty-hacks/wince-hacks/using-wince5-0-drivers-on-wince4-2</link>
		<comments>http://blog.digivation.com.au/category/nifty-hacks/wince-hacks/using-wince5-0-drivers-on-wince4-2#comments</comments>
		<pubDate>Tue, 09 Feb 2010 04:17:01 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[WinCE]]></category>
		<category><![CDATA[device driver]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[wifi]]></category>
		<category><![CDATA[wince4.2]]></category>
		<category><![CDATA[wince5]]></category>

		<guid isPermaLink="false">http://blog.digivation.com.au/?p=62</guid>
		<description><![CDATA[Since wince 4.2 is quite old and not that well supported by OEM device manufacturers, it is often hard or impossible to get drivers for wince4.2 for these devices. However the API into coredll and other parts of the wince system libraries is, if not identical, then almost identical. I had an instance recently where [...]]]></description>
			<content:encoded><![CDATA[<p>Since wince 4.2 is quite old and not that well supported by OEM device manufacturers, it is often hard or impossible to get drivers for wince4.2 for these devices.</p>
<p>However the API into coredll and other parts of the wince system libraries is, if not identical, then almost identical.</p>
<p>I had an instance recently where I needed to make a USB wifi device work with wince4.2. After doing some research, I chose a ralink 2471W based device. However it came with a wince5 driver. Binary only of course.</p>
<p>Looking at the driver dll, all the imported functions were available except 1 in the ndis.dll, that being NdisQueryPacket. In wince4.2, this fucntion is provided by a #define, but in wince5 it is a instantiated function.</p>
<p>The solution is to compile the following code to an obj, and use the lib32 to add it to ndislib.lib in the private tree.</p>
<blockquote><p><code><br />
// local modded copy of ndis.h<br />
#include "ndis.h"<br />
#include &lt;pkfuncs.h&gt;<br />
</code></p>
<p>VOID<br />
NdisQueryPacket(<br />
IN  PNDIS_PACKET            _Packet,<br />
OUT PUINT                   _PhysicalBufferCount OPTIONAL,<br />
OUT PUINT                   _BufferCount OPTIONAL,<br />
OUT PNDIS_BUFFER *          _FirstBuffer OPTIONAL,<br />
OUT PUINT                   _TotalPacketLength OPTIONAL<br />
)<br />
{<br />
NdisQueryPacketDef(_Packet, _PhysicalBufferCount, _BufferCount, _FirstBuffer, _TotalPacketLength);<br />
}</p></blockquote>
<p>Also add the export definition to the end of ndis.def so that it becomes exported when ndis.dll is built with the system.</p>
<p>Finally, remember to put these 2 files back in the private tree where you got them from.</p>
<p>Now when the system is rebuilt with platform builder, the new ndis.dll will contain this extra function, thus allowing the USB wifi driver to function perfectly without modification.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.digivation.com.au/category/nifty-hacks/wince-hacks/using-wince5-0-drivers-on-wince4-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

