Now Playing Tracks

Blackberry Playbook revitalization!

A long time ago I got a Blackberry Playbook tablet. After about a year of pretty heavy use it started having battery problems. 

Battery issue 1: Charges but immediately goes to 0% when unplugged.
The problem started where the battery would charge and show 100% but when I’d unplug the playbook it would immediately drop to 0% and shut off after a few minutes. I left this go and it evolved into issue 2.

Battery issue 2: No longer charges.
After a year or two of sitting, the playbook didn’t charge. I gave up and ordered a replacement battery from Ebay for ~$19 shipped. That, a set of spudgers, and small screw drivers were all I needed to fix my Playbook. Don’t believe the junk that sellers write about competitors not including wires. about including wires in theirs but not in the cheap knock offs. The wires are attached to the sensors, my battery only has 1 coaxial cable come with it and I was fine.

Replacing the battery:
Battery swap is pretty easy using iFixIt’s guide online. Take photos of where each screw goes.

Wi-fi issues:
After battery replacement Wi-fi no longer worked well or at all. I damaged the connections on the antennas. These were the top two coaxial wires White and black. The wireless G antenna is actually attached to the one speaker. You can try just to add solder to these joints and it may work for you. I broke mine badly so I had to shorten the G antenna wire a bit and connect the ground and center conductor. The center conductor is insulated. I melted the insulation with a lighter and then soldered. I actually ran the wire behind my battery and not under it since it was now shorter. If I come across replacements I’ll swap it out at some point.

Charging issues:
If your battery completely died you’ll need to go through a weird process to get it charged again. Dock chargers are cheaper and avoid this. If you just have the USB charger then plug it in and after the red light on the playbook goes off, unplug it. Repeat until eventually the screen comes back on. For my playbook this took about 15-20 minutes of un-plugging and re-plugging!

Good luck!

Comcast Business Internet - BYO Modem

Comcast recently added a $4ish rental fee increase into my last bill. The explanation was that it went for upkeep of equipment. What? I paid $8 for a rental modem before and now you want to charge me $12.95 a month for this?

I was pretty upset knowing that DOCSIS modems run only $60ish for a decent one. Originally when I signed up for Comcast Business internet I was told I had to use their POS gateway/modem. The router would forced double NAT and was often incompatible with lots of games I’d play when not working. The good news is apparently sometime in the last 4 years their policy changed.

If you don’t use a static IP address, you can bring your own modem to Comcast business internet. I wasn’t able to find a recent website that had this information. This is as of 10/1/14.

I have the blazing fast *sarcasm* 16/3 package for $70 a month. It includes junk like outlook, virus protection, email addresses and web hosting that I’ll never use. With the equipment fee that brought me to $85ish a month. The only reason I pay this instead of the home fee is because they don’t cap business data usage and I don’t have to call the normal Comcast tech support for most things. The cost alone might be worth it to not deal with the normal tech support.

So how do I do this?

Go here: http://mydeviceinfo.comcast.net/

Find a modem that is approved for your plan and pick it up from NewEgg or Amazon.

You can actually activate the modem without calling Comcast provided you know your Login or your Comcast account number. I disconnected my Internet and didn’t know either. More on that in a minute.

Install the new modem and connect it directly to a machine and once it connects, navigate to http://comcast.net/activate.

Login with email address or account name/number. I had neither handy because I do online billing. After one failed attempt to login (couldn’t remember comcast password) I called their help desk at the number listed. Unfortunately this was apparently the home number they listed and while they helped me it was scripted and super slow. Just ignore that and call Comcast Business services.

Next hooked my fancy Ubiquiti Edge router, cloned the MAC of my desktop PC and was all set.

Last step is to return the rental. I’m going to try to do this tonight and see how far I get. My guess is the charge won’t actually come off my next bill from the horror stories that I’ve heard. I’m prepared to be surprised.

WiiMotes as lightguns in Mame on Linux

Lightguns were the last thing on my list to configure for my arcade machine. This is an attempt at documenting how to get WiiMotes to work in a Modern version of Mame on Linux. I’m using XUbuntu, but it should work on most things.

Important information I figured out along the way:
-http://spritesmods.com/?art=wiimote-mamegun - This had most of the information. Unfortunately it is out of date. His MAME patch has since been merged into MAME and his instructions for the MAME part are wrong. I’ve stolen much from there to document it in one place. If part isn’t clear, see his guide up until the Mame setup.
-Bluetooth pairing with the WiiMotes does work using the present BlueZ stack (provided you have a non -TM labeled WiiMote) but it isn’t automatic when you turn on the WiiMotes. I couldn’t figure out how to force the pairing even when the devices were trusted.
-XWiiMote is getting there but doesn’t support IR yet when I was testing it. Stick to WMInput with cwiid like this guide shows.

I’m going to setup two WiiMotes so that MAME sees two light guns. I’m using a bluetooth dongle for this and an IR Source.

IR Source choices:
-Candles
-IR LEDs,
-Wireless Sensor Bar
-Modified wired bar, many of the old style wire bars run off 5V. If your’s does, you can take off the end and solder on a USB connection (Pin 1 and 4 on USB, center two are data). Power the sensor over a USB port on your mame box! Careful the LEDs will only light with the wires in one direction. You can find snap on USB ends around the internet. I tied a knot in my wire before installing the end to function as strain relief.

Step 1) Get WiiMotes working as Mice.
apt-get install bluetooth wminput lswm evtest

You’ll need to load a module in the kernel
sudo modprove uinput

You won’t want to do this at each boot so tell Linux to load the module. 

sudo nano /etc/modules

On the last line add: 

uinput

Save

Try to connect a WiiMote (You’ll want to disconnect it from the Wii, red button on console while it is on). Press 1+2 on the WiiMotes (possibly need the red button on back of WiiMote) and run:

lswm

You can do this one at a time or have both flashing when you start lswm. It’s going to list out the address of the WiiMotes it has detected. Copy them down.

Let’s test one without the IR source. Run the following after pressing the 1+2 buttons:

sudo wmimput ONEofTHEaddressesHERE

Tilt the WiiMote and your mouse should move on screen.

Edit the config file to use IR:

sudo nano /etc/cwiid/wminput/ir_ptr

On these lines: “Plugin.ir_ptr.X = ~ABS_X” (and the Y line), remove the tilde and save. They should look like “Plugin.ir_ptr.X = ABS_X”. You can add custom mappings here for each button if you like. Documentation is abundant online. I’m going to use the stock settings.

Run wminput with this profile:

sudo wminput -c ir_ptr ONEofTHEaddressesHERE

Setup the WiiMote scripts to run at boot. Once you pair your WiiMote (pressing 1+2) they will start functioning as a mouse.
Download this file: http://www.novaslp.net/download/wiimote/wiimote (Modified from Sprites for 2 WiiMotes). You’ll need to modify two lines near the top that read WM_BDADDR1 and WM_BDADDR2. Switch them to be the two addresses of your WiiMotes that you got from LSWM
Place it in: /etc/init.d using cp.

chmod 755 /etc/init.d/wiimote
cd /etc/init.d
sudo update-rc.d wiimote defaults 80 20

If you aren’t on a Debian distro, make sure this gets run at startup after bluetooth starts. This runs wminput with IR source flags as a daemon in the background.

Reboot. When you start back up, press 1+2 on the WiiMotes and see if they function as mice.

Step 2) Make X server recognize them as named devices.
X already can take the input and use them as Mice but it has internal names. We need to specify names for them so that we can tell Mame what they are called. We’ll do this by modifying the Xorg.conf. If you are on a modern version of X, you may not have one. We can generate one though! I found documentation here: http://ubuntuforums.org/showthread.php?t=2123353

First figure out what ID uinput gave your WiiMotes. Connect them (press 1+2) and then check out /dev/input/

cd /dev/input
ls

It’s probably the last two objects but just to be sure, use evtest to check them out.

evtest /dev/input/eventX

Once we know which two are WiiMotes, we need to tell X about them. 
Press CTRL-ALT-F1 and login

sudo service lightdm stop

(This kills XWindows on XUbuntu, If you are on plain Ubuntu sub gdm for lightdm)

sudo Xorg -configure

Edit the newly (sudo nano xorg.conf.new) generated file and add the following:

Section "InputDevice"
	Identifier "WiiMote0"
	Driver "evdev"
	Option "Device" "/dev/input/event4"
	Option "SendCoreEvents" "True"
EndSection

Section "InputDevice"
	Identifier "WiiMote1"
	Driver "evdev"
	Option "Device" "/dev/input/event5"
	Option "SendCoreEvents" "True"
EndSection

Change the devices to the devices you discovered using evtest. WiiMote0 and WiiMote1 are going to be the names we tell Mame to use.
Add these devices to the server layout section of the X config also.

	InputDevice    "WiiMote0"
	InputDevice    "WiiMote1"

You can see my completed Xorg.conf here: http://www.novaslp.net/download/wiimote/xorg.conf

Yours should look similar, but most likely not exactly the same.
Save and copy the file to where it needs to be:

sudo cp xorg.conf.net /etc/X11/xorg.conf

Restart X or reboot to restart it.

sudo service lightdm start

For me, X would crash/quit when I’d log in. If this happens to you make sure that your users .Xauthority file isn’t owned by root.

ls -la ~/.Xauthority

If it is owned by root, run the following:

chown usernamehere:usernamehere ~/.Xauthority

Assuming X started, your WiiMotes should still function as Mice.

Step 3) Configure Mame
Edit your mame.ini (mine sits in /home/username/.mame)

nano ~/.mame/mame.ini

Under core input options, switch the following to be set like this:

joystick 1
lightgun 1
offscreen_reload 1

For games that use Offscreen reload, point to the lower right site of the screen and pull the trigger to reload.

Mame will detect these as WiiMotes but sets them up as joysticks. This is okay but we’ll need to tell it that we don’t have a deadzone otherwise the WiiMote will stall around mid screen.
Add a line to the Mame.ini:

joystick_deadzone 0

Find the core input enable options and tell it the following device settings

trackball_device mouse
lightgun_device lightgun
mouse_device mouse

After that add two lines to tell mame which lightgun is which.

lightgun_index1   WiiMote0
lightgun_index2   WiiMote1

Save this file. Start mame and enter the controls setup for player 1 and 2 (Default is tab key)

Clear all the lightgun controls except the X and Y positions. 
Lightgun X Analog for player 1 should read Joy 1 A0 Nintendo WiiMote and Lightgun Y Analog for player 1 should read Joy 1 A1 Nintendo WiiMote. If it has any extra settings, clear the setting by pressing Delete then hit Enter to set a new mapping. Move your WiiMote up/down and left/right to set the respective axis. I also cleared settings for Axis increments and decrement.

I also set default button B to be fire (Mame button 1) and button A (Mame button 2) to be alternate reload.

Try a light gun game. Inside the games you’ll be able to access the Tab menu and set controls specific for that game. Here is where you’ll be able to adjust sensitivity and enable it to show a positional cursor.

If you want to set these in the default config file for mame instead of through the UI, my settings for the AXIS were:

JOYCODE_1_XAXIS
JOYCODE_1_YAXIS

If everything here worked you should see silky smooth movement of a cursor in light gun games on Mame. Congrats!

Let me know if you have any problems with this configuration!

BeagleBone GPIO input methods

I’ve been utilizing /sys/kernel/debug/gpio to get pin state on the Beagle for some time. It was a slow solution but I really enjoy simplistic things. I didn’t want to install another library.

Tonight while commuting, I became frustrated with the slowness. I spent a bit of time trying to come up with a better solution. I ended up using Adafruit’s GPIO library. It works, but isn’t ideal.

The library supports “events” which is closer to where I wanted to be. I can set an event on a pin and watch for high, low, or “both” states. The events can be polled and the call to do so is non-blocking. I don’t need to continuously poll a file or run a series of commands to see if a change has occurred. It is doing all of this work behind the scene in a much more efficient manner than I was.

The library stops a little short though of what I’d like. I’d love to have multiple events on a pin and it doesn’t look like I can do that. I can tell it to alert me when pin GPIO1_13 does something, but I can’t get a different event to trigger when it goes high, or when it goes low.

My workflow became:
Event triggers
Read Pin state

I can get around the second step if I know the previous pin state. The pins are either on or off so any event would signal a change. I still need to read the pin state at start to verify that my view of the pin states matches reality.

I’ve found come up with two solutions that feel a little better. I haven’t successfully implemented either yet.

PRU solution:
PRUs are my new hammer. My thought is to have the PRU watch the pin state. When it changes, the ASM alters memory shared between the PRU and the host. The host script runs and looks for changes. This moves the heavy lifting of the polling to the PRU. The CPU is just in a tight loop, not doing much and possibly sleeping between loops.

Device Tree:
I’m not familiar enough with the device tree files to get this working properly. I started to play around with it but got stuck. If I revisit later this week, I’ll update this. My thought was to have the pins generate keyboard events in Linux. This appears to be feasible. This eliminates my need for an intermediate script that reads events. Most of the software I wish to use can trigger off keystrokes on it’s own.

Thoughts? Do you have a better solution? I really dislike using many third party libraries to accomplish simple things like this.

Internet Speedometer

A project that Jon and I wrote for Radioshack’s weekend project series just went live! It features my PRU/Tri-Color LED driver that was previously documented here! Build this device to have a visual representation of your Internet connection speed.

We make Tumblr themes