qfoxb’s blog





  • Investigations into the Apple Digital AV Adapter

    Recently, i picked up a cheap clone of the Apple Digital AV Adapter, to record silly videos from my old iPad 4, which is running iOS 6. But to my horror, when i plugged it into the capture card, i was greeted with this screen:

    If this doesn’t scream “RETURN ME” i don’t know what does

    Well that doesn’t look right. After returning the device, I went on eBay and bought a real Digital AV adapter, and after USPS took two weeks to deliver it, i plugged it into my iPad, and bam, I have relatively-low latency output from my iPad to my TV. OK, let’s plug it into my elgato and try it out.

    No Signal – Is the iPad connected to the HDMI input and powered on?

    Shit. Did i brick it already? Let’s try plugging it into my iPhone 5:

    Wtf?

    Well, it could be about 1000 things, but the first things that came to my mind were
    · Device isn’t actually compatible and it working the first time was a fluke
    · CoolBooter sucks ass

    Alright, let’s do some deep digging.

    What processes are running in the background on the iPhone vs the iPad? I made this command to view new processes as they were created from the iDevice:

    previous=/tmp/ps_snapshot
    while true; do
    ps -axww -o pid,command > /tmp/ps_current
    diff --suppress-common-lines -u "$previous" /tmp/ps_current | grep '^[+]' | sed 's/^+//'
    mv /tmp/ps_current "$previous"
    sleep 1
    done

    The iPhone ran the following processes:

    /System/Library/PrivateFrameworks/MobileAccessoryUpdater.framework/Resources/fud 15
    /System/Library/CoreServices/USBDeviceArbitrator.app/USBDeviceArbitrator
    /usr/libexec/mobileassetd -t 15
    /usr/libexec/vendor_device_arbitrator
    /usr/libexec/accessory_device_arbitrator
    

    before displaying output.

    The iPad on the other hand, only ran

    /System/Library/PrivateFrameworks/MobileAccessoryUpdater.framework/Resources/fud 15
    /System/Library/CoreServices/USBDeviceArbitrator.app/USBDeviceArbitrator

    Well something is clearly going wrong on the iPad side, After scrolling through countless Reddit threads trying to find the problem, i was able to rule out CoolBooter as one or two other people had no issues using this adapter. I ran Console on my MacBook to see if the devices were outputting anything related to the adapter, and the iPhone looked all good, but the iPad displayed something along the lines of “DFU Failed”

    DFU? WTF? Why the fuck does this adapter need DFU Mode? Turns out: it’s running a custom SoC inside that gets it’s firmware from the Device every boot. Weird choice, but works.

    Ok. Let’s find out where the firmware is being stored in the iDevice (as of iOS 6). After running a search through the whole / filesystem for any occurances of MobileAccessory, A1438 (codename) and DFU, i found some hits at /private/var/mobile/Library/Assets/. There was a folder called "com_apple_MobileAsset_MobileAccessoryUpdate_haywire/"
    Turns out, haywire is the codename for the line of Lightning AV adapters. I copied this firmware folder from the iPhone to my computer, and looked for the corresponding folder on the iPad

    It’ s there, same directory structure and everything. Okay, what happens if i delete it?

    I unplugged and replugged the adapter, and i get a “Downloading Accessory Firmware” message. Okay, we’re getting somewhere. Let it sit for a minute, it did not actually download any firmware. Unplugged the adapter again. This time, i tried to copy the Haywire firmware from the iPhone to the iPad. Plugged it back in.

    Hell yeah!

    So TL;DR – if your Apple Digital AV Adapter isn’t working on older iOS versions, head to /private/var/mobile/Library/Assets, delete com_apple_MobileAsset_MobileAccessoryUpdate_haywire/
    unplug and re plug the adapter and wait for the Downloading message
    unplug it again
    and copy it from another working device on the same version. I cannot unfortunately provide this file because it’s copyrighted by apple 🙁

    and you’ll have a working adapter.

    Here’s the first shitpost i made with the adapter

  • i love home assistant

    you should check it out

    The Start
    For a few years, I’ve been slowly getting into Smart Home/home automation. I’ve always been super interested in random and bespoke devices and I guess it’s turned into a sort of special interest for me. my first smarthome device was a Belkin WeMo mini plug. It isn’t very mini – but it supported Apple HomeKit and Alexa, which is all I had at the time. Since then, I had picked up a few Tuya and Amazon smart plugs. If I could un-buy those and buy something better, I 100% would. But I’m not made of money, so I’m still stuck with quite a few of them.

    Home Assistant

    after picking up a Ring doorbell, I wanted to use it with HomeKit. I came across homebridge – a solution for connecting devices that aren’t HomeKit certified to HomeKit. The ring integration was fine, but I wanted to hook up those Amazon smart plugs as well. I started talking about it with @rilinium, and he started talking about home assistant. After talking about it a bit more, I decided to throw it into a docker container and see what it did. Holy shit. I was so impressed with the sheer amount of options, quality and robustness of the software. After discovering the flaws in the dockerized version of the software, I moved my installation to a HP ProDesk running Home Assistant OS, their Linux distribution that has everything out of the box. After spending hours doing as much research as I could , I started to integrate my devices. But, I wanted more.

    The Zigbee Chronicles

    After all my existing devices were setup, either using built in integrations or HACS ones, I started doing some more looking around on the HA forums for other people’s setups. After experiencing multiple Wi-Fi outages in my house over the course of a few months, I began to realize that building a smart home that relies entirely on Wi-Fi is stupid as hell and I started to look into some alternatives. That’s when I discovered Zigbee. It runs on 2.4 GHz which isn’t great But it’s cheaper than Z-Wave, Which many professional alarm systems use to communicate with their end devices. I had heard of Zigbee before from looking into Phillips hue but had dismissed it because Hue is expensive as hell. I also decided that I wanted to integrate devices that I couldn’t just replace the bulb on or attach a smart plug in between so I started to look at ways to integrate dumb switches into Home Assistant via Zigbee. I came across the third reality 3RSS009Z. It’s a device that sits over your existing Dumb switch and controls it by physically moving it up and down with a little motor I ordered a four pack and a Zigbee coordinator to get started and after connecting the coordinator to my home assistant, it discovered it immediately via the ZHA integration. I paired the switches to the coordinator and put them on the wall. everything is working great! except it wasn’t. Three or four days later they all dropped off of the network, great. I start looking into why this can happen. I switched to an alternative Zigbee control software called Zigbee2MQTT. I find it a little bit more advanced, but significantly easier when you have many many devices. After resetting everything back up this time, my network lasted about a week before disintegrating well shit are my house walls too thick. Why is everything falling off then I purchased a additional Zigbee device. This one was powered by mains power so it had a constant connection. It acts as a router/repeater, which means it will boost the signal of anything close to it like an end device, so the switches start falling off of the network after I added a few of the routers I didn’t see any interference with Wi-Fi or Bluetooth devices, which is great and I can control them with buttons that are also Zigbee even when the Wi-Fi is down. I ended up buying a few used Philips hue BR30 bulbs to fit in the dome lights in my house. after much more shopping around, I’ve purchased quite a few more Zigbee devices, including a motion sensor in the hallway that turns on the lights on the landing on low brightness whenever I walk by. I also recently discovered the SONOFF ZBMINIL2 which is a little relay that sits between your existing dumb switch, and the power to your lights, which allows you could to control them from the existing switch as well as over Zigbee. They don’t require neutral wiring, which is critical in my house that has older wiring in some of the switch boxes.

    Now

    Well i’ve been using home assistant for about 4 months now – and i’m loving it. if you’re even slightly curious about home automation and smart home and have some good technology and networking knowledge it’s definitely worth a shot! Here’s my home assistant setup and Zigbee2MQTT network:

    home assistant setup: i’ve blanked out a few integrations that are about my local utilities because i’d rather not post that. the failed setups are due to devices that are powered off
    my zigbee2mqtt network: consists primarily of hue, ikea TRADFRI, sonoff and third reality products. a couple other random devices as well

    some of this article was written with voice typing because it was 1 in the morning and i was tired – excuse any formatting errors

  • running WEBFISHING on macOS

    and why godot rocks

    This post was adapted from the previous site. Content may not look great.

    After getting addicted to playing WEBFISHING, I wanted to take it with me on my MacBook. After doing some research, I found out how easy it is to decompile a Godot game. After fucking around a lot with my friends, I decided to look into how hard it would be to re-export to macOS. After some looking around in the WEBFISHING community Discord, I found user ati had it working. So I asked, and got some answers. Turns out you actually don’t need to decompile the game at all. It’s really fucking easy to run this game on macOS, and even Linux.

    Using a specific version of GodotSteam templates, you can just replace a few files to get it to run perfectly. Included in the download of this pre-compiled Godot template is a .app file. If you browse the contents of it, rename godot_osx_release.64 to osx_template, and drop steam_appid.txt as well as WEBFISHING.pck from the Windows version (and renaming the pck to osx_template.pck), run osx_template, and the game just runs as long as you have Steam pen and have a license to the game!

    If you’d like to run it from Finder by clicking on the app, you can either modify Info.plist yourself or pick up the one I’ve uploaded here. Happy fishing! :3