<?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>Slashdev &#187; Linux</title>
	<atom:link href="http://www.slashdev.ca/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.slashdev.ca</link>
	<description>Hardware, software, and just general tinkering</description>
	<lastBuildDate>Mon, 14 Jun 2010 01:54:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Get USB Report Descriptor with Linux</title>
		<link>http://www.slashdev.ca/2010/05/08/get-usb-report-descriptor-with-linux/</link>
		<comments>http://www.slashdev.ca/2010/05/08/get-usb-report-descriptor-with-linux/#comments</comments>
		<pubDate>Sat, 08 May 2010 13:09:15 +0000</pubDate>
		<dc:creator>jiGGaK</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.slashdev.ca/?p=329</guid>
		<description><![CDATA[Came across this handy little hack today googlin around the internetz. On several occasions I&#8217;ve had the need to get the full device and report descriptors from an attached USB device. Today was another one of those occasions. If you run lsusb with the -v flag you will get a nice verbose output, but if [...]]]></description>
			<content:encoded><![CDATA[<p>Came across this handy little hack today googlin around the internetz. On several occasions I&#8217;ve had the need to get the full device and report descriptors from an attached USB device. Today was another one of those occasions. If you run <a href="http://linuxmanpages.com/man8/lsusb.8.php">lsusb</a> with the <em>-v</em> flag you will get a nice verbose output, but if you locate the section that contains the report descriptor you&#8217;ll be welcomed with a typical Linux friendly message: <strong>** UNAVAILABLE **</strong>.</p>
<div id="attachment_331" class="wp-caption aligncenter" style="width: 462px"><a href="http://www.slashdev.ca/wp-content/uploads/2010/05/error.png"><img src="http://www.slashdev.ca/wp-content/uploads/2010/05/error-452x300.png" alt="" title="error" width="452" height="300" class="size-medium wp-image-331" /></a><p class="wp-caption-text">OH NOOZ!!1!</p></div>
<p>I thought to myself, self: &#8220;certainly there must be <em>some way</em> to tame this beast?&#8221;. Wouldn&#8217;t you know it, there certainly is.</p>
<p><span id="more-329"></span></p>
<p>Start by plugging in your fancy pants USB device and running <tt>dmesg</tt> to get the kernel output for the event. It will look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">input: Sony PLAYSTATION(R)3 Controller as /devices/pci0000:00/0000:00:04.1/usb2/2-4/2-4.2/2-4.2:1.0/input/input16
sony 0003:054C:0268.000F: input,hiddev0,hidraw3: USB HID v1.11 Joystick [Sony PLAYSTATION(R)3 Controller] on usb-0000:00:04.1-4.2/input0</pre></div></div>

<p>The first line <em>input: &#8230;</em> is what we want. It contains the full device path and in this case we are interested in third last component of the path: <strong>2-4.2:1.0</strong>.</p>
<p>Now run <tt>lsusb</tt> and locate the entry for your device.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Bus 002 Device 024: ID 054c:0268 Sony Corp. Batoh Device</pre></div></div>

<p>Using the VendorID:ProductID pair from the output we can get verbose output from <tt>lsusb</tt> for just the device we are interested in and nothing else:</p>
<p><code>lsusb -vd 054c:0268</code></p>
<p>This is when we see that <tt>lsusb</tt> flat out refuses to show us the report descriptor. To get it, we need to <em>unbind</em> the device first (as root).</p>
<p><code>sudo bash -c "echo -n 2-4.2:1.0 >/sys/bus/usb/drivers/usbhid/unbind"</code></p>
<p>Now run <tt>lsusb</tt> again for the device and you should see the report descriptor in the output!</p>
<p><code>lsusb -vd 054c:0268</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdev.ca/2010/05/08/get-usb-report-descriptor-with-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Notch in the Cross Platform Blackberry Development Belt</title>
		<link>http://www.slashdev.ca/2009/03/11/a-notch-in-the-cross-platform-blackberry-development-belt/</link>
		<comments>http://www.slashdev.ca/2009/03/11/a-notch-in-the-cross-platform-blackberry-development-belt/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 14:03:06 +0000</pubDate>
		<dc:creator>jiGGaK</dc:creator>
				<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.slashdev.ca/?p=212</guid>
		<description><![CDATA[In a previous post I listed 4 key items needed for BlackBerry development:

Rapc compiler
Signature tool
Simulator
Javaloader

At the time of writing the first two worked fine.  The third, Simulator, is if&#8217;y at best.  And the fourth was just not possible.
Until now.  In late December, a saviour by the name of Nicolas Vivien dropped by [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a href="http://www.slashdev.ca/2008/04/03/blackberry-development-using-linux/">previous post</a> I listed 4 key items needed for BlackBerry development:</p>
<ol>
<li>Rapc compiler</li>
<li>Signature tool</li>
<li>Simulator</li>
<li>Javaloader</li>
</ol>
<p>At the time of writing the first two worked fine.  The third, Simulator, is <a href="http://www.slashdev.ca/2008/03/27/blackberry-simulator-in-linux-sort-of">if&#8217;y at best</a>.  And the fourth was just not possible.</p>
<p>Until now.  In late December, a saviour by the name of Nicolas Vivien dropped by the <a href="http://www.netdirect.ca/software/packages/barry/">barry</a> mailing list to let everyone know that he was hard at work on reverse engineering the Javaloader USB protocol.  Within a few weeks he had developed a proof of concept that enabled users to load cod files to the BlackBerry.</p>
<p>Since then several developers (including myself) have chipped in to implement all of the crucial aspects of the Javaloader needed for day-to-day use.</p>
<p><span id="more-212"></span></p>
<h2>Which Commands are Supported?</h2>
<ul>
<li>list modules on handheld, including siblings</li>
<li>get handheld info</li>
<li>load one or more cod files onto the handheld</li>
<li>save one or more cod files from the handheld</li>
<li>erase cod files from the handheld</li>
<li>dump the eventlog</li>
<li>clear the eventlog</li>
<li>get screenshot of the handheld and save as bmp</li>
<li>set time on the handheld</li>
<li>wipe the applications and/or file system on the handheld</li>
</ul>
<p>As you can see, most of the important stuff is already finished.  And more is being added all the time.</p>
<h2>I&#8217;ve Heard Enough&#8230; Gimme, Gimme, Gimme!</h2>
<p>The Javaloader is slated to be included in the next release of Barry; version 0.15.  If you would like to test it right now, you&#8217;ll need to compile from source or find a binary package for your OS/distro.</p>
<p>Here are some instructions for <a href="http://www.netdirect.ca/software/packages/barry/cvs.php">compiling from source</a>.  If you get stuck, someone on the <a href="http://sourceforge.net/mail/?group_id=153722">mailing list</a> might be able to lend a hand.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdev.ca/2009/03/11/a-notch-in-the-cross-platform-blackberry-development-belt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lean Mean Mediacenter Machine</title>
		<link>http://www.slashdev.ca/2008/08/11/lean-mean-mediacenter-machine/</link>
		<comments>http://www.slashdev.ca/2008/08/11/lean-mean-mediacenter-machine/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 22:19:34 +0000</pubDate>
		<dc:creator>jiGGaK</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Make]]></category>

		<guid isPermaLink="false">http://www.slashdev.ca/?p=131</guid>
		<description><![CDATA[A short time ago Handbrake began to ship with default encoding settings for the &#8220;Normal&#8221; profile using 2-pass h264 encoding.  Sadly my XBox and XBMC just weren&#8217;t up to the task of decoding all those fancy h264 bits in software anymore.
Naturally instead of adjusting the encoding parameters, I decided to begin the hunt for [...]]]></description>
			<content:encoded><![CDATA[<p>A short time ago <a href="http://handbrake.fr/">Handbrake</a> began to ship with default encoding settings for the &#8220;Normal&#8221; profile using 2-pass h264 encoding.  Sadly my <a href="xbox-remote-onoff">XBox</a> and <a href="http://xbmc.org/">XBMC</a> just weren&#8217;t up to the task of decoding all those fancy h264 bits in software anymore.</p>
<p>Naturally instead of adjusting the encoding parameters, I decided to begin the hunt for a new video player&#8230; oh and it has to be cheaper than that <a href="http://www.apple.com/appletv/">AppleTV</a> thing since it does h264.  It also has to be similarly quiet, power efficient, and small.</p>
<div id="attachment_141" class="wp-caption alignleft" style="width: 310px"><a href="http://www.slashdev.ca/wp-content/uploads/2008/07/finished_case.jpg"><img src="http://www.slashdev.ca/wp-content/uploads/2008/07/finished_case-300x167.jpg" alt="Not quite an AppleTV" title="finished_case" width="300" height="167" class="size-medium wp-image-141" /></a><p class="wp-caption-text">Not quite an Apple TV</p></div>
<p>Well this is the result.  It&#8217;s a bit bigger than an AppleTV but it&#8217;s certainly quiet and power efficient.  And I actually quite like the look of it.</p>
<p><br style="clear: both" /><br />
<span id="more-131"></span></p>
<h2>Hardware</h2>
<div id="attachment_143" class="wp-caption alignright" style="width: 160px"><a href="http://www.slashdev.ca/wp-content/uploads/2008/07/hardware.jpg"><img src="http://www.slashdev.ca/wp-content/uploads/2008/07/hardware-150x112.jpg" alt="The beginnings of a mediacenter pc" title="Hardware" width="150" height="112" class="size-thumbnail wp-image-143" /></a><p class="wp-caption-text">The beginnings of a mediacenter pc</p></div>
<p>D201GLY2TA MiniITX board, 1GB Kingston DDR2 667MHz, picoPSU 120W, Transcend 4GB x266 CF, and SAT2CF by startech.com.  Board, PSU/AC-DC converter came from <a href="http://www.mini-box.com">mini-box.com</a>, the memory and CF card from <a href="http://www.canadacomputers.com">canadacomputers.com</a> and the CF-SATA adaptor from <a href="http://www.ncix.com">ncix.com</a>.  Cost breakdown:</p>
<p><br style="clear: both" /></p>
<table>
<tr>
<th>Item</th>
<th>Cost</th>
<th>Comments</th>
</tr>
<tr>
<td>D201GLY2TA</td>
<td>$75.00</td>
<td>crappy frackin BIOS, not very Linux friendly&#8230; but it&#8217;s CHEAP!</td>
</tr>
<tr>
<td>picoPSU-120 power kit</td>
<td>$54.95</td>
<td>small, efficient, awesome&#8230; nuff said</td>
</tr>
<tr>
<td>CF200 IDE to CF adaptor</td>
<td>$9.50</td>
<td>BIOS is garbage, or the adaptor sucks&#8230; needless to say $10 down the crap shoot</td>
</tr>
<tr>
<td>1GB Memory</td>
<td>$29.99</td>
<td>it works</td>
</tr>
<tr>
<td>Trancend 4GB CF</td>
<td>$51.99</td>
<td>also, just works</td>
</tr>
<tr>
<td>SAT2CF</td>
<td>$38.04</td>
<td>slooooooow, as frack!  but so far not much of an issue</td>
</tr>
</table>
<p>Grand total including taxes, shipping and brokerage fees&#8230; aprox. $370 CDN.  Mother, %$*#!  That&#8217;s way more than the AppleTV.  Oh well, at least I didn&#8217;t have to give Apple Inc. any more of my hard earned money and this thing <strong>should</strong> be much more customizable&#8230; right?  Read on for details of the software.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdev.ca/2008/08/11/lean-mean-mediacenter-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simulator in Linux &#8211; Slightly More Reliable</title>
		<link>http://www.slashdev.ca/2008/04/10/simulator-in-linux-slightly-more-reliable/</link>
		<comments>http://www.slashdev.ca/2008/04/10/simulator-in-linux-slightly-more-reliable/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 03:20:38 +0000</pubDate>
		<dc:creator>jiGGaK</dc:creator>
				<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.slashdev.ca/2008/04/10/simulator-in-linux-slightly-more-reliable/</guid>
		<description><![CDATA[
Debug session with eclipse in Linux

Disclaimer: I am not an expert with wine nor have I ever claimed to be.  But if you setup an override for the msxml dll it seems as though the BlackBerry simulator is a bit more reliable in Linux.  In fact, the JDWP seems to actually work for [...]]]></description>
			<content:encoded><![CDATA[<div class="imageframe imgalignleft" style="width:300px;"><a href="http://www.slashdev.ca/wp-content/uploads/2008/04/debug-blackberry-linux.png" title="Debug session with eclipse in Linux"><img src="http://www.slashdev.ca/wp-content/uploads/2008/04/debug-blackberry-linux.thumbnail.png" width="300" height="187" alt="Debug session with eclipse in Linux" /></a>
<div class="imagecaption">Debug session with eclipse in Linux</div>
</div>
<p>Disclaimer: I am not an expert with <a href="http://www.winehq.org">wine</a> nor have I ever claimed to be.  But if you setup an override for the msxml dll it seems as though the BlackBerry simulator is a bit more reliable in Linux.  In fact, the JDWP seems to actually work for debugging  your applications.</p>
<p><br style="clear: both;"/><br />
<span id="more-124"></span></p>
<h1>Fix JDWP</h1>
<p>First you need to fix the JDWP.  I outlined the steps required to do this in my last article about <a href="/2008/03/27/blackberry-simulator-in-linux-sort-of">running the simulator in Linux</a>.</p>
<h1>DLL Overrides</h1>
<p>Copy the DLL files from a Windows box.  Again, I actually have no idea what I&#8217;m doing so I just went and copied all the DLL&#8217;s named <strong><tt>msxml*</tt></strong> from <tt>C:\WINDOWS\system32</tt> to my local wine directory <tt>~/.wine/drive_c/windows/system32</tt>.  It&#8217;s probably not necessary to copy all of them, but I don&#8217;t think it will hurt anything either.</p>
<p>Start up <tt>winecfg</tt> and select the <em>Libraries</em> tab.  Type <em>msxml3</em> in the <em>New override for library:</em> field and click Add.</p>
<div style="text-align: center;">
<div class="imageframe imgaligncenter" style="width:219px;"><a href="http://www.slashdev.ca/wp-content/uploads/2008/04/winecfg-linux.png" title="Winecfg with dll override"><img src="http://www.slashdev.ca/wp-content/uploads/2008/04/winecfg-linux.thumbnail.png" width="219" height="300" alt="Winecfg with dll override" /></a>
<div class="imagecaption">Winecfg with dll override</div>
</div>
</div>
<p>Start the JDWP and connect to it from your favorite IDE and watch the madness ensue.  Now I have not tested this thoroughly but my first couple of tries seem to work well.  So well in fact that I might event be able to ditch the VM running windows for debugging.  As always, <a href="http://en.wiktionary.org/wiki/your_mileage_may_vary">YMMV</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdev.ca/2008/04/10/simulator-in-linux-slightly-more-reliable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BlackBerry Development Using Linux</title>
		<link>http://www.slashdev.ca/2008/04/03/blackberry-development-using-linux/</link>
		<comments>http://www.slashdev.ca/2008/04/03/blackberry-development-using-linux/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 23:43:54 +0000</pubDate>
		<dc:creator>jiGGaK</dc:creator>
				<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.slashdev.ca/2008/04/03/blackberry-development-using-linux/</guid>
		<description><![CDATA[Now this process isn&#8217;t 100% ideal.  If you are an experienced developer you probably already know you need four key components.

Rapc compiler
Signature tool
Simulator
Javaloader

The first two components works fabulously in Linux.  The second (signature tool) needs a kick in the pants to work (shame shame shame!).
The third is hit or miss when using Wine. [...]]]></description>
			<content:encoded><![CDATA[<p>Now this process isn&#8217;t 100% ideal.  If you are an experienced developer you probably already know you need four key components.</p>
<ol>
<li>Rapc compiler</li>
<li>Signature tool</li>
<li>Simulator</li>
<li>Javaloader</li>
</ol>
<p>The first two components works fabulously in Linux.  The second (signature tool) needs a <a href="/2008/03/16/using-sigtool-in-linux">kick in the pants</a> to work (shame shame shame!).</p>
<p>The third is <a href="/2008/03/27/blackberry-simulator-in-linux-sort-of">hit or miss</a> when using <a href="http://www.winehq.org/">Wine</a>.  So a less painful option is to put windows in a virtual machine and run the simulator there (more on that later).</p>
<p>And the fourth I just can&#8217;t get past.  There is the <a href="http://sourceforge.net/projects/barry">barry project</a> which has made impressive progress in the last few months and lists javaloader support as on the roadmap for milestone 4.  RIM, if you have any sympathy for us non-windows users show these guys some love and <a href="https://lists.sourceforge.net/lists/listinfo/barry-devel">send them</a> some specs for heaven sakes!</p>
<p>This article presents the basics for compiling, signing, and debugging BlackBerry applications with Linux.</p>
<p><span id="more-113"></span></p>
<h1>Rapc Compiler</h1>
<p>First you need a copy of the JDE or the JDE components package.  In my last <a href="/2008/03/27/blackberry-simulator-in-linux-sort-of">article</a> I covered a method of extracting the install packages distributed by RIM, but if you have access to a Windows box copying the installed JDE works just fine too.</p>
<p>The rapc compiler needs two external commands:</p>
<ol>
<li>Java Compiler (javac)</li>
<li>Preverification Tool (preverify)</li>
</ol>
<p>Install the Sun JDK to get javac:</p>
<p><code>sudo apt-get install sun-java5-jdk</code></p>
<p>The preverify command can be obtained by downloading the <a href="http://java.sun.com/products/sjwtoolkit/download.html">Sun WTK</a>.</p>
<p><code>chmod +x sun_java_wireless_toolkit-2_5_2-linux.bin<br />
./sun_java_wireless_toolkit-2_5_2-linux.bin<br />
</code></p>
<p>For some reason this package complains it can&#8217;t find Java interpreter.  If this happens, the Java 5 JDK is located <tt>/usr/lib/jvm/java-1.5.0-sun/bin</tt> on Ubuntu.</p>
<p>Once extracted, unless you plan on doing vanilla J2ME development, you can copy the preverify tool and then delete the WTK.</p>
<p><code>mkdir ~/bin<br />
cp ~/lib/WTK2.5.2/bin/preverify* ~/bin<br />
rm -r ~/lib/WTK2.5.2<br />
</code></p>
<p>Don&#8217;t forget to put the <tt>~/bin</tt> directory in the execution path.  To have this set automatically each time you login, put this line in your <tt>~/.bash_profile</tt> file (create it if necessary).</p>
<p><code>export PATH=~/bin:$PATH</code></p>
<h1>Compile &#8220;Hello, World!&#8221;</h1>
<p>I&#8217;ll be using <a href="http://ant.apache.org/">Apache Ant</a> for building because it&#8217;s the common denominator when it comes to building Java projects (like it or not).  Most IDE&#8217;s have some level of support for running ant scripts.</p>
<p>Install ant:</p>
<p><code>sudo apt-get install ant</code></p>
<p>Download <a href="http://sourceforge.net/project/showfiles.php?group_id=195339">bb ant tools</a> and put it where ant can find it:</p>
<p><code>unzip bb-ant-tools-0.7-bin.zip<br />
mkdir -p ~/.ant/lib<br />
cp bb-ant-tools.jar ~/.ant/lib<br />
</code></p>
<p>Download the <a href="/download/hello.tar.gz">hello world</a> project and run <tt>"ant"</tt> in the project directory:</p>
<p><code>wget http://www.slashdev.ca/download/hello.tar.gz<br />
tar -xzf hello.tar.gz<br />
cd hello<br />
ant<br />
</code></p>
<p>Output from the ant should look something like this:</p>
<pre class="console">
josh@ubuntu:~/hello$ ant
Buildfile: build.xml

build:
    [mkdir] Created dir: /home/josh/hello/build
     [rapc] Compiling 1 source files to ca_slashdev_hello.cod

BUILD SUCCESSFUL
Total time: 1 second
</pre>
<h1>Signing</h1>
<p>To sign your cod files, follow my guide on how to <a href="/2008/03/16/using-sigtool-in-linux">fix the signature tool</a>.  Then just run the <em>sign</em> target in the build script.</p>
<p><code>ant sign</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdev.ca/2008/04/03/blackberry-development-using-linux/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>MDS Simulator&#8230; in Linux</title>
		<link>http://www.slashdev.ca/2008/04/03/mds-simulator-in-linux/</link>
		<comments>http://www.slashdev.ca/2008/04/03/mds-simulator-in-linux/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 17:42:49 +0000</pubDate>
		<dc:creator>jiGGaK</dc:creator>
				<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.slashdev.ca/2008/04/03/mds-simulator-in-linux/</guid>
		<description><![CDATA[This was actually pretty trivial since the MDS simulator is pure Java, and a good portion of it is actually just Tomcat.  Since Tomcat is not developed by RIM, the chances where pretty good that there where no hard coded backslash directory separators (no, I will never let that go)  


MDS simulator log [...]]]></description>
			<content:encoded><![CDATA[<p>This was actually pretty trivial since the MDS simulator is pure Java, and a good portion of it is actually just <a href="http://tomcat.apache.org/">Tomcat</a>.  Since <a href="http://tomcat.apache.org/">Tomcat</a> is not developed by RIM, the chances where pretty good that there where no hard coded <a href="/2008/03/16/using-sigtool-in-linux">backslash directory separators</a> (no, I will never let that go) <img src='http://www.slashdev.ca/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<div style="text-align: center;">
<div class="imageframe imgaligncenter" style="width:400px;"><a href="http://www.slashdev.ca/wp-content/uploads/2008/04/screenshot-jde43-mds-linux.png" title="MDS simulator log output"><img src="http://www.slashdev.ca/wp-content/uploads/2008/04/screenshot-jde43-mds-linux.thumbnail.png" width="400" height="184" alt="MDS simulator log output" /></a>
<div class="imagecaption">MDS simulator log output</div>
</div>
</div>
<p>All you have to do is create a new script to replace the various batch files that ship with the MDS simulator.  Here is the replacement for run.bat</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> classpath<span style="color: #000000; font-weight: bold;">/*</span> webserver<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/*</span>; <span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #007800;">MDS_CP</span>=<span style="color: #007800;">$i</span>:<span style="color: #800000;">${MDS_CP}</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
java <span style="color: #660033;">-classpath</span> <span style="color: #800000;">${MDS_CP}</span> <span style="color: #660033;">-Xmx512M</span> -DKeystore.Password=password \
   net.rim.application.ipproxyservice.IPProxyServiceApplication \
   -log.console.dump</pre></div></div>

<p>Don&#8217;t forget to set the execute permission:<br />
<code>chmod +x run.sh</code></p>
<p>To shutdown MDS, just hit <tt>&lt;ctrl&gt;+c</tt> in the terminal window to kill the process.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdev.ca/2008/04/03/mds-simulator-in-linux/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>BlackBerry Simulator in Linux &#8211; Sort of</title>
		<link>http://www.slashdev.ca/2008/03/27/blackberry-simulator-in-linux-sort-of/</link>
		<comments>http://www.slashdev.ca/2008/03/27/blackberry-simulator-in-linux-sort-of/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 20:57:14 +0000</pubDate>
		<dc:creator>jiGGaK</dc:creator>
				<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.slashdev.ca/2008/03/27/blackberry-simulator-in-linux-sort-of/</guid>
		<description><![CDATA[
8800 Simulator in Wine/Linux

Call me crazy but I just can&#8217;t seem to accept that if you want to (or have to) write BlackBerry software you&#8217;re stuck with Windows.  It bugs me.
There is good news and bad news regarding the simulator.  The good news is with a recent version of Wine you can actually [...]]]></description>
			<content:encoded><![CDATA[<div class="imageframe imgalignleft" style="width:112px;"><a href="http://www.slashdev.ca/wp-content/uploads/2008/03/screenshot-blackberry-8800-simulator.png" title="8800 Simulator in Wine/Linux"><img src="http://www.slashdev.ca/wp-content/uploads/2008/03/screenshot-blackberry-8800-simulator.thumbnail.png" width="112" height="200" alt="8800 Simulator in Wine/Linux" /></a>
<div class="imagecaption">8800 Simulator in Wine/Linux</div>
</div>
<p>Call me crazy but I just can&#8217;t seem to accept that if you want to (or have to) write BlackBerry software you&#8217;re stuck with Windows.  It bugs me.</p>
<p>There is good news and bad news regarding the simulator.  The good news is with a recent version of <a href="http://www.winehq.org/">Wine</a> you can actually get the BlackBerry simulator to run.  The bad news is that it&#8217;s a bit buggy, and debugging hardly works at all.</p>
<p><br style="clear:both;" /><br />
<span id="more-109"></span></p>
<h1>What to expect</h1>
<p>Your millage may vary!  Generally I find that the simulator is usable for most testing.  Attaching a debugger to it (via JDWP) just seems to cause the simulator to hang.  Mind you, I have a rather slow system (AMD XP 2500+) and I would love to hear about your experiences if you have a faster computer.</p>
<h1>Ingredients</h1>
<p><a href="http://www.winehq.org/">Wine</a> &#8211; You need the most recent version you can get your hands on.  The package in the Ubuntu repository won&#8217;t due.  So if you have installed this one, remove it and follow <a href="http://www.winehq.org/site/download-deb">these</a> instructions to get the latest and greatest.</p>
<p>For some reason until I performed the following steps, the simulator would always crash on startup:</p>
<ol>
<li><tt>rm -rf ~/.wine</tt></li>
<li>Start up <tt>winecfg</tt></li>
<li><strong>Applications</strong> tab &#8211; select <em>Windows 2000</em> from the dropdown list</li>
<li><strong>Audio</strong> tab &#8211; select <em>ALSA Driver</em> from the drivers list</li>
</ol>
<p>It should go without saying that you will need a copy of the <a href="http://na.blackberry.com/eng/developers/downloads/jde.jsp">JDE</a> or one of the <a href="http://na.blackberry.com/eng/developers/downloads/simulators.jsp">simulator</a> packages.  If you have access to a Windows box, just zip up the JDE or simulator and copy over.  Otherwise, there are a few tricks to extracting the contents of the setup package.</p>
<p>Extract the setup package:<br />
<code>wine BlackBerry_JDE_4.2.1.exe /extract:c:\\</code></p>
<p>Which extracts the files to <tt>~/.wine/drive_c/</tt></p>
<p>Use msiexec to install the package:<br />
<code>wine msiexec /a c:\\jde_installer.msi /qn</code></p>
<p>Which extracts the file to <tt>~/.wine/drive_c/Program Files/Research In Motion/BlackBerry JDE 4.2.1</tt>. This is a cumbersome path at best so move this somewhere more usable:<br />
<code>mv ~/.wine/drive_c/Program Files/Research In Motion/BlackBerry JDE 4.2.1 ~/lib/JDE4.2.1</code></p>
<p>Cleanup:<br />
<code>rm ~/.wine/drive_c/jde_*</code></p>
<h1>Run the simulator</h1>
<p>I created a shell script from one of the existing batch files for launching:<br />
<code>cat 8800.bat | dos2unix > 8800.sh<br />
gvim 8800.sh<br />
</code></p>
<p>Replace the <tt>@echo off</tt> with <tt>#!/bin/bash</tt> and insert the wine command before the fledge.exe.  Mine looks like this:</p>
<pre>
#!/bin/bash
wine fledge.exe /app=Jvm.dll /handheld=8800 /session=8800 \\
/app-param=DisableRegistration /app-param=JvmAlxConfigFile:8800.xml \\
/data-port=0x4d44 /data-port=0x4d4e /pin=0x2100000A
</pre>
<p>Set the execute permission:<br />
<code>chmod +x 8800.sh</code></p>
<p>Now just run it!<br />
<code>./8800.sh</code></p>
<p>Don&#8217;t give up if the first time you run it the thing crashes.  Give it a few tries.</p>
<h1>Debugger</h1>
<p>So you fancy yourself an adventurer do ya!?!  Well, good luck.</p>
<p>Thankfully, RIM hasn&#8217;t made the same mistake with JDWP as they did with the <a href="/2008/03/16/using-sigtool-in-linux">signature tool</a> but you will still have to modify a number of text files to convert the Windows path names to Unix ones.</p>
<p><code>cd ~/lib/JDE4.2.1/bin</code><br />
<code>cp SimPackage-JDE.rc SimPackage-JDE.orig<br />
cat SimPackage-JDE.orig | sed 's/\(Command.*\)=%/\1=wine %/' | sed 's/\\/\//g' > SimPackage-JDE.rc<br />
</code><br />
<code>cp FixedBuild.rc FixedBuild.orig<br />
cat FixedBuild.orig | sed 's/\(Command.*\)=%/\1=wine %/' | sed 's/\\/\//g' > FixedBuild.rc<br />
</code><br />
<code>cp DefaultBuild.rc DefaultBuild.orig<br />
cat DefaultBuild.orig | sed 's/\\/\//g' > DefaultBuild.rc<br />
</code></p>
<p>If you copied the JDE from a Windows box you might need to update other files.  You must also <strong>remove</strong> Settings.rc if it already exists.</p>
<p>Make sure you have the Sun Java Runtime installed by running <tt>java -version</tt>.  Now all that&#8217;s left is to start up the JDWP:<br />
<code>java -jar JDWP.jar</code></p>
<p>On startup, there will be an error message about RIMUsbJni.dll but you can safely ignore this. And that&#8217;s just about it; your JDWP client connects as usual (jdb, eclipse, netbeans).  Feel free to leave your successes/failures in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdev.ca/2008/03/27/blackberry-simulator-in-linux-sort-of/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Using sigtool in Linux</title>
		<link>http://www.slashdev.ca/2008/03/16/using-sigtool-in-linux/</link>
		<comments>http://www.slashdev.ca/2008/03/16/using-sigtool-in-linux/#comments</comments>
		<pubDate>Sun, 16 Mar 2008 20:37:42 +0000</pubDate>
		<dc:creator>jiGGaK</dc:creator>
				<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.slashdev.ca/2008/03/16/using-sigtool-in-linux/</guid>
		<description><![CDATA[Being obsessive and all, I decided to sit down and figure out why the signature tool doesn&#8217;t seem to work in Linux.  After all it&#8217;s a rather trivial Java application.  I suspected from the start that the symptom was some sloppy programming on RIM&#8217;s part, hard coding Windows style path names and my [...]]]></description>
			<content:encoded><![CDATA[<p>Being obsessive and all, I decided to sit down and figure out why the signature tool doesn&#8217;t seem to work in Linux.  After all it&#8217;s a rather trivial Java application.  I suspected from the start that the symptom was some sloppy programming on RIM&#8217;s part, hard coding Windows style path names and my suspicion was correct.  After modifying two class files and reassembling SignatureTool.jar the signature tool worked like a charm!</p>
<p>I don&#8217;t know what the legality is regarding redistribution of RIM&#8217;s development tools, specifically ones that have been modified so what follows is a description of the steps required to modify SignatureTool.jar to work in a Unix style file system (forward slash for directory separators).</p>
<p><span id="more-102"></span></p>
<h2>Get SignatureTool.jar and extract it</h2>
<p>It goes without saying that you will need the Java Runtime installed before starting.  I would recommend the Sun JRE.  In Ubuntu, you can install this by running <code>sudo apt-get sun-java5-jre</code></p>
<p>Grab a copy of the SignatureTool.jar and put it somewhere along with your .csk and .db files.  I am using SignatureTool.jar from version 4.3 of the JDE.  The remainder of this guide might be specific to this version as I will be editing constants and referring to them by index numbers.<br />
<code>~/lib/RIM43/bin/SignatureTool.jar<br />
~/lib/RIM43/bin/sigtool.csk<br />
~/lib/RIM43/bin/sigtool.db<br />
</code></p>
<p>Extract the SignatureTool.jar file into a temporary directory:<br />
<code>cd ~/lib/RIM43/bin<br />
mkdir tmp<br />
jar -xf SignatureTool.jar -C tmp<br />
</code></p>
<h2>Editing the class files</h2>
<p>Now I tried using a hex editor and a decompiler but by far the easiest method was to use a program called <a href="http://classeditor.sourceforge.net/">ClassEditor</a> to modify the two files in question.  Download the <a href="http://downloads.sourceforge.net/classeditor/ce2.23.tar.gz?modtime=1079827200&#038;big_mirror=0">binary release</a> and extract it, and run it with the command:<br />
<code>java -jar ce.jar</code></p>
<p>Open two class files extracted earlier: <em>q.class</em> and <em>ad.class</em>.  ClassEditor will look something like this:</p>
<div style="text-align: center;">
<div class="imageframe imgaligncenter" style="width:200px;"><a href="http://www.slashdev.ca/wp-content/uploads/2008/03/screenshot-classeditor-0.png" title="screenshot-classeditor-0.png"><img src="http://www.slashdev.ca/wp-content/uploads/2008/03/screenshot-classeditor-0.thumbnail.png" width="200" height="150" alt="screenshot-classeditor-0.png" /></a>
<div class="imagecaption">ClassEditor with q.class and ad.class</div>
</div>
</div>
<p>Start with q.class and select the <strong>Constant Pool</strong> tab.  In this file we need to change string constants containing just a single backslash character.  There are actually two constants in the pool but the first is just a reference to the second.  The string we want is at index 223.</p>
<div style="text-align: center;">
<div class="imageframe imgaligncenter" style="width:200px;"><a href="http://www.slashdev.ca/wp-content/uploads/2008/03/screenshot-classeditor-1.png" title="screenshot-classeditor-1.png"><img src="http://www.slashdev.ca/wp-content/uploads/2008/03/screenshot-classeditor-1.thumbnail.png" width="200" height="150" alt="screenshot-classeditor-1.png" /></a>
<div class="imagecaption">String constant at index 223</div>
</div>
</div>
<p>By default ClassEditor starts in read only mode so click the bright green <strong>Modify Mode(Off)</strong> button in the top right.  The fields in the details area are now editable.  Simply change the forward slash to a backslash and click Modify.  Click save and that&#8217;s it for q.class!</p>
<div style="text-align: center;">
<div class="imageframe imgaligncenter" style="width:200px;"><a href="http://www.slashdev.ca/wp-content/uploads/2008/03/screenshot-classeditor-2.png" title="screenshot-classeditor-2.png"><img src="http://www.slashdev.ca/wp-content/uploads/2008/03/screenshot-classeditor-2.thumbnail.png" width="200" height="150" alt="screenshot-classeditor-2.png" /></a>
<div class="imagecaption">String constant 223 modified</div>
</div>
</div>
<p>Select ad.class on left and locate constant 117, again in the <strong>Constant Pool</strong> tab.</p>
<div style="text-align: center;">
<div class="imageframe imgaligncenter" style="width:200px;"><a href="http://www.slashdev.ca/wp-content/uploads/2008/03/screenshot-classeditor-3.png" title="screenshot-classeditor-3.png"><img src="http://www.slashdev.ca/wp-content/uploads/2008/03/screenshot-classeditor-3.thumbnail.png" width="200" height="150" alt="screenshot-classeditor-3.png" /></a>
<div class="imagecaption">String constant at index 117</div>
</div>
</div>
<p>Change the value from <strong>\sigtool.set</strong> to <strong>/sigtool.set</strong> and click Modify.  Click save and that&#8217;s it for ad.class.</p>
<div style="text-align: center;">
<div class="imageframe imgaligncenter" style="width:200px;"><a href="http://www.slashdev.ca/wp-content/uploads/2008/03/screenshot-classeditor-4.png" title="screenshot-classeditor-4.png"><img src="http://www.slashdev.ca/wp-content/uploads/2008/03/screenshot-classeditor-4.thumbnail.png" width="200" height="150" alt="screenshot-classeditor-4.png" /></a>
<div class="imagecaption">String constant 117 modified</div>
</div>
</div>
<h2>Repack SignatureTool.jar and test</h2>
<p>To repack SignatureTool.jar just cd to the temporary directory where you extracted the jar and rejar the class files<br />
<code>cd ~/lib/RIM43/bin/tmp<br />
jar -cmf META-INF/MANIFEST.MF ../SignatureTool.jar *<br />
</code></p>
<p>Go up one directory and remove the temp directory<br />
<code>cd ..<br />
rm -rf tmp<br />
</code></p>
<p>To test that everything worked, just run the command<br />
<code>java -jar SignatureTool.jar</code></p>
<p>If should prompt you to locate a cod file.  Just cancel this and click the Properties button in the main signature tool window.  If you see a list of Registered Signers it worked!</p>
<div style="text-align: center;">
<div class="imageframe imgaligncenter" style="width:200px;"><a href="http://www.slashdev.ca/wp-content/uploads/2008/03/screenshot-properties.png" title="screenshot-properties.png"><img src="http://www.slashdev.ca/wp-content/uploads/2008/03/screenshot-properties.thumbnail.png" width="200" height="181" alt="screenshot-properties.png" /></a>
<div class="imagecaption">Properties windows with registered signers</div>
</div>
</div>
<h2>RIM are you listening?</h2>
<p>At the off chance that someone from RIM is reading this, please forward this to whoever maintains this tool:</p>
<ul>
<li>Locate class containing the string &#8220;\sigtool.set&#8221;</li>
<li>Change to java.io.File.separator + &#8220;sigtool.set&#8221;</li>
<li>Locate class containing the strings &#8220;\\&#8221; + &#8220;sigtool.db&#8221;</li>
<li>Change to java.io.File.separator + &#8220;sigtool.db&#8221;</li>
<li>Locate class containing the strings &#8220;\\&#8221; + &#8220;sigtool.csk&#8221;</li>
<li>Change to java.io.File.separator + &#8220;sigtool.csk&#8221;</li>
</ul>
<p>Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdev.ca/2008/03/16/using-sigtool-in-linux/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
	</channel>
</rss>
