i2c

February 24, 2011

Black goes to pin 1
White goes to pin 3

I keep forgetting.

tty settings for serial trace

January 26, 2011

# stty < /dev/ttyUSB0
speed 115200 baud; line = 0;
min = 1; time = 5;
ignbrk -brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

To get these settings, run the following:
# stty 115200 -ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke time 5 min 1 < /dev/ttyUSB0

Replace /dev/ttyUSB0 with the device of choice. I only know that 115200 is the baud rate, and everything else is uncertain to me. They are simple concepts, but I haven’t bothered to figure them out, and I’ll bet that a lot of them are unnecessary.

RHEL/SLES default routes with multiple network interfaces (DHCP)

November 4, 2010

Most enterprise NICs nowadays come with 2 ports… including the one that my company makes. On our test systems, we use 1 port on the onboard/Intel NIC for the test system to stay connected to the world, while the other NIC may be on/off/unstable depending on the test.

We prefer DHCP by default for all IPs, and the onboard NIC to use eth[01] while our test/development NIC uses eth[23]. All DHCP transactions provide a gateway address.

However, different operating systems have different behavior when determining which route to set up as default, when there are multiple interfaces. RHEL tends to use the last activated interface. SLES seems to use the first one, BUT on our older set of chassis, the DHCP transaction for our onboard NIC (with the desired default route) doesn’t complete “in a timely manner” (40 seconds), gets backgrounded, and the network configurator uses the next “working interface” for its default gateway.

For RHEL, we simply specify GATEWAYDEV=eth0 in /etc/sysconfig/network and that solved our issues, in a simple manner, while letting us keep DHCP. No DEFROUTE= in each /etc/sysconfig/network-scripts/ifcfg-eth* file or anything.

Unfortunately, such a simple solution doesn’t apply to SLES. For SLES 10, I set WAIT_FOR_INTERFACES="60" and added the “slow” NIC to MANDATORY_INTERFACES, both in /etc/sysconfig/network/config. (I also set FIREWALL="no" for good measure, but that is likely irrelevant.) Enabling DEBUG in ./config and ./dhcp didn’t seem to help at all. For SLES 11, I do the same thing, though the style of entry in MANDATORY_INTERFACES is a bit different, and it doesn’t really … seem to work well.

At the end of the day, spanning tree on the switch was causing link negotiation to take like 30 seconds or something, which is why we saw the DHCPDISCOVER coming down the OS stack but not out the wire until 30+ seconds later. It really shouldn’t, and this is a hacked out solution, but meh…

DavMail CLI-only on a Seagate Dockstar running Debian

October 29, 2010

So I have Debian Squeeze running on a Seagate Dockstar… you can google around for this distro running on a 4-watt embedded device — I’m not going to explain it here.

I wanted to get DavMail running on it, so I went to install java packages. I ended up installing default-jre. But I had to update the package lists first — I ended up with some 404s on package names that had been renamed since my last update.

DavMail uses Java.SWT graphical elements by default. By setting davmail.server=true you can run it without an X11 display. All other items in your .davmail.properties can be default.

Corporate relocation into network strangeness

October 27, 2010

At the old location we had a gateway for the automation network (172.30.x.x) with 2 NICs. One NIC was the 172.30.1.1 and the other NIC was just “another machine on the corporate network”. The IT guys defined for 172.30.x.x to get routed over the corporate network to our gateway… etc.

But then we got bought, and integrated our network into theirs. Fortunately they didn’t have machines on that IPv4 network already, but we still had to fight to preserve our subnet. Because changing over 1000 IPs is a real pain in the ass. (It shouldn’t be, but the implementation is not my choice or design.)

There’s some NAT involved now when we connect between the two networks.. anything from corporate shows up as 192.168.47.254 to the test systems. Can no longer uniquely identify who is logged on to the system :(

Now to the real issue. Since we moved in, some VNC sessions would just… reset over time. My ssh was fine. VNC sessions on *my* systems were fine. Wireshark led to nothing. Upon placing the mouse cursor back into the session, the VNC client would attempt to send a packet and the other end would RST. There was no traffic on the wire for a long time. The connection was dropped by the NAT/firewall.

Why is there no active traffic on those sessions, but on my sessions or ssh? Easy. A blinking cursor or the clock changing every minute generates enough traffic for the VNC session to stay alive – “keepalive traffic”. As for SSH, I’ve had “ServerAliveInterval 600” in my ~/.ssh/config ever since my first (public) server would kick out inactive connections after an hour.

I disabled the screensaver (merely a blanking of the screen for Linuxes) on the suspicious targets and the issue is “gone”.

Flat tire

October 21, 2010

I picked up my car from the shop in LA and went to Long Beach on Saturday night. Assumed 32 PSI all around and went driving around Long Beach and left for the Bay Area at 4pm. The light turned on around 6-7pm between Buttonwillow and Kettleman City (can’t remember). The light came on but I didn’t know the rate of deflation. I *think* the light comes on at 28 PSI, meaning I lost 4 PSI since the time that I hit the nail.

Work has been really busy as well so I didn’t address it for a full 48 hours.

Tuesday 12pm after parking at work, I see that it’s ridiculously flat, enough to warrant fairly immediate action. I actually waited until I got off at 8pm and my emergency kit measured about 10 PSI. At that low of pressure I don’t see any reliable readings. The other tires measured 32 (factory) and 32 at the gas stations (yes, I used 2), but 36 on my emergency kit, so I assumed my meter was +4. I also obtained another meter, with an offset of -1. I figured it was in the low 10s. I pumped it up to 34.

Wednesday morning at 10am, the light wasn’t on. That means it lost less than 6, assuming the light triggers at 28. However when I get off work at 7pm, the light turned on – confirmed the leak. I measured it at 26. In just about 24 hours, it lost 8 PSI.

Using this PSI deflation rate (which is totally inaccurate due to weather, road conditions, speed, etc) I tried to backtrace the series of events that led to this. Losing 4PSI in 12hours meant that I hit the nail Sunday morning around 6-7am, which is the time we went from the hotel to the marathon, which makes sense! So here’s an orderly (and probably errorful – deflation isn’t constant, etc) list:

  1. Sunday 6-7am (32 PSI): Hit nail
  2. Sunday 6-7pm (28 PSI): Light comes on
  3. Monday 10am: Estimated 23 PSI. The tire probably still looked normal at this point.
  4. Monday 9pm: Estimated 19 PSI. Too tired from work and too dark to see anything.
  5. Tuesday 12pm: Estimated 14 PSI. Obviously very flat, but not dead. I wait till off-work to address the issue. Too bad that doesn’t occur until 8pm…
  6. Tuesday 8pm: 12 PSI? no accurate reading at this point. Pump at Chevron (free) to “20″, but it doesn’t go further. Pump at Valero (it works!) to 34.
  7. Wednesday 10am: Light not on, so still above 28 PSI.
  8. Wednesday 7pm (26 PSI): Light on. Estimated 8PSI/12hours deflation rate to figure stuff out.

Broken CHIPSBNK 1gb USB drive – recovered!

September 20, 2010

Okay, well… not the data. I don’t keep important data on USB drives anyhow; it’s a horrible idea.

I somehow hosed up the USB drive to the point where the BIOS (and consequently, OS) wouldn’t even recognize it. It’d just keep blinking. I’ve plugged it in 20 or so times now and decided to randomly plug it into my Seagate Dockstar. It recognized it as a 8MB capacity flash drive with 1 RAW 8MB partition.

# /sbin/fdisk -l

Disk /dev/sda: 8 MB, 8388608 bytes
1 heads, 16 sectors/track, 1024 cylinders
Units = cylinders of 16 * 512 = 8192 bytes

Disk /dev/sda doesn't contain a valid partition table

I thought.. okay. Maybe I can use fdisk to force the head/sector/cylinder count.

Pogoplug:~$ /sbin/fdisk
BusyBox v1.7.0 (2008-02-26 19:25:17 IST) multi-call binary

Usage: fdisk [-luv] [-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] DISK

Change partition table

Options:
-l List partition table(s)
-u Give Start and End in sector (instead of cylinder) units
-s PARTITION Give partition size(s) in blocks
-b 2048 (for certain MO disks) use 2048-byte sectors
-C CYLINDERS Set the number of cylinders
-H HEADS Set the number of heads
-S SECTORS Set the number of sectors
-v Give fdisk version

Pogoplug:~$

The problem is I don’t know which values to use :P. So I came across this thread and found a utility called UMPTOOL that sorta just does everything. It figured out the controller and flash on my USB stick and all I had to do was hit the “go” button and it “fixed” everything. I now have a proper disk layout and partition table and can use it again… hooray.

I’m thinking about using it for ITG2, but I think I actually care about the integrity of that data…

So here’s how it happened… it was holding a Ubuntu image (the image “burned” onto the stick, that is, so I can boot from it) and I decided to take it to an arcade to save my ITG2 data for the first time. After I was done playing I pulled out my stick but I don’t know if the system unmounted it correctly. I don’t even know if it supports non-FAT partitions (and what does a Ubuntu USB stick use? ext4?) but it claimed to write correctly. When I got home I plugged it in and attempted to format it, knowing that there was stuff I didn’t want on it, but that failed, and… on the next boot, it just kept flashing.

Palm Touchstone

August 11, 2010

For those who don’t know – you connect microUSB to the Touchstone and “dock” the phone (it sticks magnetically) on it to charge, for wireless charging. WebOS (OS on Palm Pre) is Touchstone-aware in the sense that it will act differently when the device is connected to a Touchstone.

I didn’t think it was worth $100, or $80, or $60, down to $20, but eventually I wanted to be able to mount my phone in my car in a GPS-like position, since it is sometimes my GPS and music player as well. I also wanted to be able to effortlessly put it on to charge before starting to drive, instead of fumbling for the cable and opening the slot on my phone, which usually slows down our group (I tend to be the driver) by a few seconds. I caved in to this $20 deal but the back cover was another $15! (usually $20 after tax!) Lame. It came with a dual port car charger too, which is quite interesting.

It’s a Verizon branded charger, with a microUSB output *and* a USB port. I connected the official Palm USB cable to the USB port, and the other end to the Touchstone. That way I could choose between charging my phone via Touchstone wirelessly, or use the car charger’s wired output, without disconnecting the Touchstone setup. Good to go, right?

Wrong. No charging is done with the Touchstone. People have said that you need a high-current (1 A) charger to use it properly. So I experimented.

  1. Palm wall charger with Palm USB-microUSB cable, direct to phone – works (duh)
  2. Car charger microUSB, direct to phone – works (duh)
  3. Car charger auxiliary USB port with Palm USB-microUSB cable, to touchstone – does not work (no!!!! and hence the debugging begins…)
  4. Palm wall charger with Palm USB-microUSB cable, to touchstone – works (okay, the Touchstone works, and so does the cable…)
  5. Car charger auxiliary USB port with Palm USB-microUSB cable, direct to phone – works (okay, the aux port works…)
  6. Car charger microUSB, to touchstone – barely fits, and… works!

This setup hasn’t been working for a few weeks and I’m finally getting around to it (avoiding spending my time with my friends though…) but this is quite frustrating. Each of the individual components work, but there’s something wrong with connecting the car charger’s auxiliary USB port to the Touchstone. I really like this car charger too.

I don’t see anything interesting in /var/log/messages.

For now, I have the car charger’s aux output hanging around to my cup holder (since it works), and the car charger’s regular output going to the Touchstone. It’s a squiggly wire so it’s sorta bulky and in the way but it’s not too bad.

On the audio side of things, I have a splitter and 2 male-male audio cables. One goes to the Touchstone area (if only the Touchstone itself had audio output and wireless audio…) and one goes to my cup holder.

So whether I decide to charge my phone on the Touchstone or wired near the cup holder, I’ll have both power and audio jacks available. I really should’ve done this a week or two ago.

PayPal fees

August 5, 2010

PayPal WILL CHARGE a fee if you use a card.
PayPal WILL NOT CHARGE a fee if you use cash/your bank account.

If the transaction is a PURCHASE, PayPal will not show you the fee involved (if there is one.) The buyer is abstracted from the (potential) fee and the seller will have to pay it (if there is one.. ie if you use a card.)

If the transaction is PERSONAL, PayPal will ask you if you want to pay the fee or let the other person pay it. There’s no abstraction here, because PayPal assumes you know the other person because it’s a personal transaction. Once again, this is only relevant if there’s a fee involved, which occurs if you use a card. If it’s cash+personal, no fee box will prompt at all.

card rebate summary

July 30, 2010

penfed:
5% gas
2% supermarket
1% all
3% electronics until aug 31

chase freedom with checking/exclusive benefits:
1 point = reward 1 cent cash or other stuff
spend $400 = get 400 points = get “$4″
10% extra bonus points = get 440 points.. so basically 1.1%
10 points for every transaction.. so 1.1% + “10 cents”

rotating special .. 5% gas/airline/hotel/auto rental (on up to $1500 spent.. kinda low) from july-sept. other categories for other months.
1% everything else.


Follow

Get every new post delivered to your Inbox.