Operation: Crappy Sewing Machine commences

This weekend, I went to a bra-making workshop and won a sewing machine in a raffle. It isn’t really crappy, but I spent a couple of hours un-jamming it, so I’m bitter.

The interesting thing about this machine is that it has a built-in camera, so you can take photos and video of exactly what you’re sewing and see them on the app. You can also buy new stitches from your phone and transfer them to your machine, so I started getting curious: what protocol is my sewing machine using? Could I write my own client?

I took a look at the manual, but there was nothing more technical than how to install the app in there. I checked the website, no other documentation there. I debated contacting customer service, but if I liked talking to people I wouldn’t be a programmer, so I fired up Wireshark and took a look at the network. I’m not too proficient with Wireshark, though, so I couldn’t figure out how to make it capture anything useful.

After a couple hours of fighting with it, I gave in and emailed customer support. I figured maybe they’d just forward me to a developer who would be happy to tell me about their protocol. Nope:

As far as the communication from the sewing machine to the app goes, I don’t know all the nuts and bolts but I do know it is proprietary information and is one of the features that makes the Spiegel 60609 so unique!

Bleh.

I realized that it would probably be easier for me to decompile the app, rather than sniffing the network, so I downloaded the APK using a sketchy service (I’m not sure if this is the best one out there, but it’s the least-offensive one I found) and undexed it using dex2jar:

$ chmod +x *.sh
$ ./d2j-dex2jar.sh path/to/Spiegel Social Sewing App_v1.0.4_apkpure.com.apk
dex2jar ../sewing-machine/Spiegel Social Sewing App_v1.0.4_apkpure.com.apk -> ./Spiegel Social Sewing App_v1.0.4_apkpure.com-dex2jar.jar

I opened it up in Intellij and boom, source code. Unfortunately, Intellij’s built-in decompiler choked on the one most interesting class (com.spiegel.android.spiegel.app.ui.settings.SpiegelMachineFacadeImpl). I tried to debug why (it could open every other .class file), but realized it would probably be easier to try another decompiler. I fired up JD-Gui and out popped the source!

Screen Shot 2016-04-12 at 9.13.51 PM

Turned out my sewing machine is running a PHP server, which is easy enough to communicate with. I think there are ~20 of these machines in the wild, so this is unlikely to be of any use to anyone, ever, but I look forward to writing my own client.

Here’s a video from it of it jamming the first time I attempted to use it:

Zen and the Art of Sewing Machine Matinence

(Which is a terrible book, by the way.)

I read Schneier on Security, which is an interesting blog about security and squids. (Wait, is the plural of “squid” just “squid”?) See, every Friday he post something squid-related, and last week it was an 8-foot squid pillow. Well, obviously I had to make one for myself.

I went to one of the fabric stores on Orchard Street to get fabric. “How much per yard?” I asked the salesman as he pulled down a bolt.

“Five dollars.”

It had a stupid flowed pattern on it, and I wouldn’t want my 8′ stuffed squid to look ridiculous. “How about that one?” I asked.

“Five dollars.”

“And that one?”

“Five dollars.”

“Okay, I’ll take two yards. How much is a package of stuffing?”

“Five dollars.”

In retrospect, I should have asked for ermine.

I got home, cut the pattern out of newspaper, pinned it to the fabric, and cut out all the pieces. I pinned everything together and I pulled out my sewing machine. I put the first piece in and started up the machine. It went fwipafwipafwipafwipa. All was right with the world. As I started down the second seam, it went fwipafwipafwipaSCREEfwipaSCREEfwipaSCREECH-SCREECH-SCREECH.

I stopped.

I unscrewed the case and looked for parts that could be oiled. There were, as far as I could tell, two moving parts. I oiled them, put everything back together, and tried again. Now, not only did it screech, but the needle didn’t move up and down. I had apparently oiled something that once moved the needle through friction.

So now I have a paperweight. I’m going to have one more look at it and then find a sewing machine repair shop.

It annoys me that I can easily partition my hard disk or install more RAM on my computer, yet a machine built in 1918 has gotten the best of me.