Brother MFC-J425W Scanner Buttons onto CentOS-6.4

Uncategorized No Comments »

I’m trying to get my scanner to send content to a CentOS-6.4 VM; I’m certain now it’s a case of using the buttons to trigger a request to pull content, which indeed fits the definition of what is actually happening in a modern day “push” of data (for example, MMS is really a short SMS to come and get a big payload; push-email is a notice to come and get stuff).

So. There I was. a MFC-J425W is really a brscan4 daemon, so I grabbed that:

  1. http://www.brother.com/pub/bsc/linux/dlf/brscan4-0.4.1-6.x86_64.rpm
  2. http://www.brother.com/pub/bsc/linux/dlf/brscan-skey-0.2.4-1.x86_64.rpm

Problem is, the install %post scriptlet of brscan4 called its own /opt/brother/scanner/brscan4/setupSaneScan4 which on line 13 went looking for /etc/sane.d/dll.conf which is part of sane. Unfortunately, the notion of “dependency” escapes those brscan* RPMs, so I’ll need to add that RPM as well. sane drags in most of the state of Georgia (well, maybe just sane-frontends which pulls in libexif, libgphoto2, libieee1284, libtool-ltdl, libv4l, lockdev, sane-backends, sane-backends-libs, and sane-backends-libs-gphoto2)

A re-install of the brscan twins (yum erase, yum localinstall) doesn’t experience the same error, so I’m onto a good start.

A quick “sudo /usr/bin/brsaneconfig4 -a name=Groucho model=MFC-J425W ip=10.0.0.12” got me a registered printer under scanimage -L:

device `brother4:net1;dev0' is a Brother Groucho MFC-J425W

Success. I think ?

The next step would be a scanner-button-daemon such as scanbd; I want to use the provided Brother brscan-skey and I found that after scanimage -L found the scanner, brscan-skey can as well:

$ sudo brscan-skey -l

$ sudo brscan-skey -t
$ sudo brscan-skey
$ sudo brscan-skey -l

Groucho : brother4:net1;dev0 : 10.0.0.12 Active

That’s a fair amount of progress for the day. These are mostly notes for myself, but I hope someone else can benefit. My next step would be a customization of the brscan-skey such as per http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/instruction_scn5.html

APC 9617 DHCP on MacOSX

Uncategorized No Comments »

The APC UPS controller AP9617 requires an additional DHCP Option 43 set to “APC” to indicate that the DHCP specifically knows it’s talking to an infrastructure device; it’ll refuse all DHCP not bearing this string. This avoids misconfigurations but can be a pain to realize and configure. MacOSX uses opensource code for its daemons but really prefers this XML-ish “plist” config (I’m not a fan of this nearly-XML because although it leverages the concise “yes, this is markup” and escaped content, it is positional (change the order of the sibling “key” and “value” and it’s all screwed up), and it cannot be addressed/read in XPath notation. Even locating the proper plist config file can be non-trivial.

The shortcut:

  1. insert “<key>dhcp_option_43</key><data>AQQxQVBD</data>” into /private/etc/bootpd.plist and
  2. sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist to activate

The detail:

In Standard ISC Bind config, (Keith Perry @sciatl.com)
# The following class identifier is used by the APC UPS: "APC"

class "APCUPS" {
match if substring (option vendor-class-identifier, 0, 3) = "APC";
}

# The following line populates the lease file with
# the Vendor Class Identifier that the client sends.

set vendor-string = option vendor-class-identifier;
# APC Network
subnet 10.1.0.0 netmask 255.255.192.0 {
pool {
deny dynamic bootp clients;
option routers 10.1.63.254;
option broadcast-address 10.1.63.255;
option subnet-mask 255.255.192.0;
range 10.1.0.201 10.1.63.250;
authoritative;
filename "APC.bin";
next-server 10.1.0.1;
option vendor-encapsulated-options "APC";
allow members of "APCUPS";
ping-check TRUE;
}
}

On MacOSX, /etc/bootpd.plist is the key component, read by a daemon started using sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist (http://www.jacquesf.com/2011/04/mac-os-x-dhcp-server/). Tests can be made by making changes and “kill -HUP” (sighupping) the daemon, but it seems the underlying stack has already reserved a redirection for UDP/67 so running a bootpd or dhcpd outside of the launchctl won’t bind to the port (already in use).

The problem as well is that the <key>dhcp_option_43</key> we need to add to the config (to tell the APC that it’s OK, we know it’s an APC, you can accept this DHCP) isn’t one that MacOSX bootpd knows the format of, so it’ll complain (in the console log). Instead of a simple <key>…</key><value>…</value>, we need to use <key>…</key><data>…</data>, and the data needs to be Base64-encoded. I used http://hogehoge.tk/tool-i/, then checked it as follows:

$ echo -n 'AQQxQVBD'|base64 -D|od -tx1
0000000 01 04 31 41 50 43

This value is “code #1, length 4, #31, A, P, C”; AP9617 Documentation refers to this ‘1 A P C’ as “The APC cookie”. #31 might be the ASCII ‘1’ or an APC-specific “set option #31 to this value” marker.

The AP9617 then asks for an IP in a quicker mode when it’s just booting (cold-boot to Request is approx 18 seconds):

0.0.0.0.bootpc > broadcasthost.bootps: [no cksum] BOOTP/DHCP, Request from 00:c0:b7:12:34:56 (oui Unknown), length 300, xid 0x317e, secs 32, Flags [none] (0x0000)
Client-Ethernet-Address 00:c0:b7:12:34:56 (oui Unknown)
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
Vendor-Class Option 60, length 3: "APC"
Client-ID Option 61, length 7: ether 00:c0:b7:12:34:56
CLASS Option 77, length 3: "MSP"

When it has no valid lease, it’ll eventually drop to a fuller Request or a Discover; as you can see, it has absorbed the IP that I had sent it without the proper Option-43 set, so it seems to be re-asking with the offered IP address of 192.168.1.2 in a sort of “are you sure? (and please answer with option 43 set)”. Notice “Vendor-Option” is set in the Parameter Request line — I assume that’s specifically asking for Option-43.

14:54:25.674991 IP (tos 0x0, ttl 64, id 38, offset 0, flags [none], proto UDP (17), length 576)
0.0.0.0.bootpc > broadcasthost.bootps: [no cksum] BOOTP/DHCP, Request from 00:c0:b7:12:34:56 (oui Unknown), length 548, xid 0x317e, secs 64, Flags [none] (0x0000)
Client-Ethernet-Address 00:c0:b7:12:34:56 (oui Unknown)
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Request
Requested-IP Option 50, length 4: 192.168.1.2
Parameter-Request Option 55, length 13:
Domain-Name-Server, Default-Gateway, Subnet-Mask, Domain-Name
TFTP, BF, BS, Vendor-Option
RN, RB, NTP, Time-Zone
Hostname
Server-ID Option 54, length 4: 192.168.1.1
Vendor-Class Option 60, length 3: "APC"
Client-ID Option 61, length 7: ether 00:c0:b7:12:34:56
CLASS Option 77, length 3: "MSP"

With our DHCP server set up in /etc/bootpd.plist, we’re happy to oblige:

192.168.2.1.bootps > 192.168.1.2.bootpc: [udp sum ok] BOOTP/DHCP, Reply, length 300, xid 0x317e, Flags [none] (0x0000)
Your-IP 192.168.1.2
Server-IP 192.168.1.1
Client-Ethernet-Address 00:c0:b7:12:34:56 (oui Unknown)
sname "ACLARK-LT.local"
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: ACK
Server-ID Option 54, length 4: 192.168.1.1
Lease-Time Option 51, length 4: 85536
Domain-Name-Server Option 6, length 4: 192.168.1.1
Default-Gateway Option 3, length 4: 192.168.1.1
Subnet-Mask Option 1, length 4: 255.255.255.0
Vendor-Option Option 43, length 6: 1.4.49.65.80.67

Once it’s online, you can choose to accept DHCP offers lacking the APC Cookie for robustness; I did, but it opens me to rogue IPs. I think in my environment, there’s a higher risk of forgetting the random little bits that this device needs to appease its ego. Just take the IP and have a nice day ūüôā

The New Expanded Installer (or "XServe2,1 Mavericks") (still fails)

Uncategorized No Comments »

Based on the research in Macrumours thread #1404548 by dead.xx, The following is my altered walk-through for creation of an installer for XServe2,1 (Xserve 2008)

My source is /dev/disk2

  1. Enable hidden files:
    • defaults write com.apple.finder AppleShowAllFiles -bool true && osascript -e 'quit app "Finder"'
    • (credit: Lauri Ranta
  2. Using the App Store, download — but do not run — Mavericks
    • success is a directory created, called “/Applications/Install OS X Mavericks/”
  3. Mount the InstallESD disk:
    • hdiutil attach -noautoopen -noverify /Applications/Install OS X Mavericks.app/Contents/SharedSupport/InstallESD.dmg
    • creates a /Volumes/OS X Install ESD
  4. Mount the Base System:
    • hdiutil attach -noautoopen -noverify /Volumes/OS X Install ESD/BaseSystem.dmg
    • creates a /Volumes/OS X Base System
  5. use Disk Utility to format your installation media as HFS+:
    • diskutil partitionDisk /dev/disk2 1 GPT HFS+ "Install OS X Mavericks" R
    • Note: the first partition as an EFI is assumed by GPT format
  6. Restore the Base System to your installation media:
      • asr restore --source /Volumes/OS X Install ESD/BaseSystem.dmg --target /dev/disk2s2 --erase --noprompt
      • might need “sudo”
      • mounts a second “OS X Base System” as “/Volumes/OS X Base System 1”
  7. copy mach_kernel from the root dir of OS X Install ESD to the root dir of your installation media (not needed, same kernel)
  8. copy Packages from the root dir of Mac OS X Install ESD to /System/Installation of your installation source:
    • rm -fr /Volumes/OS X Base System 1/System/Installation/Packages
    • cp -r /Volumes/OS X Install ESD/Packages /Volumes/OS X Base System 1/System/Installation/
    • In my case, /Volumes/OS X Base System 1/System/Installation/Packages links to a non-existent PackageLink directory; skipping
  9. edit /System/Installation/Packages/OSInstall.mpkg (skipped)
  10. copy boot.efi form the patch (skipped: 64-bit hardware)
  11. edit /System/Library/CoreServices/PlatformSupport.plist to add board ID and name of the mac:
    • vi /Volumes/OS X Base System 1/System/Library/CoreServices/PlatformSupport.plist
    • Add Mac-F42289C8 to the first list
    • Add Xserve2,1 to the second list
    • $ diff -c /Volumes/OS X Base System 1/System/Library/CoreServices/com.apple.recovery.boot/PlatformSupport.plist /Volumes/OS X Base System 1/System/Library/CoreServices/PlatformSupport.plist

      $ diff -c /Volumes/OS X Base System 1/System/Library/CoreServices/com.apple.recovery.boot/PlatformSupport.plist /Volumes/OS X Base System 1/System/Library/CoreServices/PlatformSupport.plist

      *** /Volumes/OS X Base System 1/System/Library/CoreServices/com.apple.recovery.boot/PlatformSupport.plist 2013-08-24 18:40:19.000000000 -0700

      — /Volumes/OS X Base System 1/System/Library/CoreServices/PlatformSupport.plist 2014-02-11 22:03:45.000000000 -0800

      ***************

      *** 71,76 ****

      — 71,77 —-

          <string>Mac-C3EC7CD22292981F</string>

          <string>Mac-942B5BF58194151B</string>

          <string>Mac-F2218EC8</string>

        + <string>Mac-F42289C8</string>

          </array>

         <key>SupportedModelProperties</key>

        <array>

      ***************

      *** 127,132 ****

      — 128,134 —-

         <string>MacBookAir5,2</string>

         <string>MacPro3,1</string>

         <string>MacBookAir5,1</string>

        + <string>Xserve2,1</string>

        </array>

       </dict>

      </plist>

  12. copy the modified PlatformSupport.plist to /System/Library/CoreServices/com.apple.recovery.boot
    • cp /Volumes/OS X Base System 1/System/Library/CoreServices/PlatformSupport.plist /Volumes/OS X Base System 1/System/Library/CoreServices/com.apple.recovery.boot/PlatformSupport.plist
  13. boot the target using your installation media, and install; while installing:
  14. copy the modified PlatformSupport.plist to /System/Library/CoreServices/ while installing, before the reboot:
    • open a terminal on the target
    • cp PlatformSupport.plist /System/Library/CoreServices/PlatformSupport.plist (to be confirmed)

Unfortunately, during installation, the installer contacts Apple to get a list of valid hardware. That fails me.

Fuck you, git

Uncategorized No Comments »

Try number 2 for git.

I’m not a genius, but for fucks sake, why did my one-step action become 26?

git rebase, git merge, git commit, git add (a file that’s already added), git commit (again), git rebase, git merge, git git git git gitigitigitigititititit

this replaces:

svn update

I seriously don’t yet see a compelling reason to change.

Fuck you, git. seriously. fuck you.

Inaccuracy may Inhibit

Uncategorized No Comments »

Consider the effect of inaccuracy on Engineers when posing a task or asking a question. ¬†It may reveal why you’re not getting what you expect.

Read the rest of this entry »

Why SOPA and PIPA are incapable of helping, while still dangerous

Uncategorized No Comments »

SOPA and PIPA¬†are two attempted bills in the US that seek to stop online piracy. ¬†These two acts are incapable of actually stopping piracy, yet remain fully capable of an “internet death-penalty” against innocent sites.

Consider arriving in a strange, new city during the era of prohibition.  In order to find stores, markets, and local associates, you pick up two telephone guides.  Remember the White Pages and Yellow Pages?  Consider those as your resources, except that your phonebooks update instantly.

You’re able to look up your friend Mike, who has invited you to dinner. ¬†His address is in the white pages, telling you “Mike Smith: 123 Main St”, and you know how to get there. ¬†Mike lives above a tailoring shop, and has a market nearby, which you’re able to find to buy some beef enroute to dinner.

What about a bottle of wine? ¬†That would be nice, but it’s prohibition, everything with any alcohol is illegal.

On the way to Mike’s, beef in-hand (a couple of excellent steaks), you notice that the tailor shop below him is closed, yet many people keep entering and leaving. ¬†That’s odd. ¬†Mike is happy to see you when you get to his door, and he makes a great dinner; he suggests doing so again next week.

Next week, Pork’s on the menu, but you have to look up the market again. ¬†You wrote down the name (Joey’s Eastside Butcher) and your whitepages tell you where it is. ¬†Mike tells you on the phone to be careful, police have detected that the Tailor shop is a Speak-Easy, and is illegal. ¬†As a lawful citizen, despite that you’d like a drink occasionally, you tend to stay away from that sort of place anyhow.

Off to the butcher’s, but wait… where’s Mike’s place? ¬†The whitepages no longer list his building at all. ¬†From your always-updated whitepages, Mike’s entire building is gone. ¬†You ask a friend, they have one that doesn’t update as quickly, and it shows that last week, Mike’s address was 123 Main St. ¬†yeah, that’s right. ¬†Another friend has a version of whitepages from Germany, and although in a different language, it does show the local city, and it agrees: Mike’s address is still 123 Main St. ¬†Good thing you wrote down Mike’s phone number itself rather than his name, or you’d lose all contact with Mike. ¬†You should get yourself a German phonebook, or use one that doesn’t delete entries, just adds them.

Arriving at Mike’s building, you notice that the Speak-Easy is doing a brisk trade. ¬†It hasn’t been shut down! ¬†The police haven’t lifted a finger, just “hid” it by removing Mike’s building from the whitepages. ¬†Everyone who goes there often knows exactly where it is; if they haven’t, they’ve written down the phone number already, or have it on speed-dial.

This is how these new bills work: they don’t stop crime, they simply allow it to become unlisted quickly, without any recourse, any due-process. ¬†They just make it harder to find, quickly. ¬†The internet whitepages is called “DNS”, and is controlled by many different countries. ¬†DNS updates take up to 72 hours to occur, and even after that time, the services are still open. ¬†Anyone using these services knows where to find them without having to look them up, but if they need to, they can use alternative listings to find the same address. ¬†The piracy isn’t even affected, it continues unabated, but common people are affected: new arrivals at a website or an interest group, and those who have to find their websites when they move (which happens about as frequently as people change homes)

Worse, with some allusion to Brazil, and perhaps to some implementations of photo-radar speed-traps, there’s no double-checking of errors, no due-process. ¬†Due to an error, not only is a building, and all it’s businesses gone, while they are barely making it through the recession. ¬†I’m sure the people who think this is a good idea are not the small businesses and private citizens who can vanish immediately due to error. ¬†… and we know the Department of Homeland Security makes no mistakes.

Would you give the “Internet Kill Switch” to the TSA?

Criminals will simply go to other countries’ DNS, or just use the numbers, leaving only the lawful to be the victims of bad legislation and the zealots who support it.

Crime should be stopped by actually stopping crime, not by making it and its innocent neighbours into unlisted addresses.

iPhone 4s and iPhone4 Physical Case Differences

Uncategorized No Comments »

After some false-starts on iPhone cases (burned off my previous one, and i kinda don’t miss it), I wanted to post a quick note pointing others to a detailed description of some key differences.

iCollectGadgets shows a few great photos, but the key is in the following two (with permission, I’m willing to host a copy of these on my site to reduce any bandwidth-stealing):

Button Alignment:

Earbud 3.5mm Socket:

I would strongly recommend checking out the original site: https://icollectgadget.wordpress.com/2011/10/09/how-to-choose-cases-for-iphone-4s-and-iphone-4/

Battery Life: non-optimal

Uncategorized No Comments »

Teo phones taken from chargers this morning at 8:00: the latest HTC Android, and an iPhone 4, not a 4S. The iOS device has all manner of 3G, wifi, location services activated, the HTC perhaps the same.

IPhone is 80% battery, HTC is 57%. Sure, optimal conditions rate the content the other way, but we all know our wifi access points will hit 300 feet / 100meters range in an optimal situation: real life differs, and for my usage, HTC with MAYBE the same services active is burning battery twice as quickly.

Not sure Android is winning yet.

ConfirmEdit Nailed my WikiMedia

Uncategorized No Comments »

So I suddenly saw this:

Fatal error: Call to undefined method WebRequest::getIP() in extensions/ConfirmEdit/Captcha.php on line 202

Apparently, this is due to rev 106097, which replaced wfGetIP() with a wgRequest->getIP() that doesn’t exist. Maybe it’s in Yesterday’s version of WikiMedia only. ūüôĀ

My fix:
cd extensions/ConfirmEdit
svn update -r 106096

I’m putting this blog entry so that others may see it and make use of it.

Bundling in Java

Uncategorized No Comments »

In providing a simple java-stack copy of an internal tool, I found that a few resources helped me define a basic layout, which I’ve hand-generated in the makefile since then.

Bart’s work on bundling an OSX App from a Java Jar helped to get a start, but more helped to find the other bits.

Nakkaya.com helped to remind to use Spotlight to find the tools that move around occasionally; unfortunately, that’s a ANT-focused article, and I’m not really interested in adding build-level dependencies yet. Eventually, I’m probably going to have to look at where a resource is inside the jar, but that’s really unrelated to Apple’s bundler.

In general, I used Bart’s work in Nakaya’s spotlight-found Bundler to make the original Info.Plist, built a diff-target to show that I was generating an exact copy, then expanded the built/generated copy to include more jar files as needed. If it gets more complex, or I need to combine JARs, I’ll probably look at ANT at the time, but for now, just text-printing XML, not a big requirement.

Yeah, this is another not to remid myself later ūüôā

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in