Linux Hotplug Events Explained

There was a time when Linux was much simpler. You’d load a driver, it would find your device at boot up, or it wouldn’t. That was it. Now, though, people plug and unplug USB devices all the time and expect the system to react appropriately. [Arcanenibble] explains all “the gory details” about what really happens when you plug or unplug a device.

You might think, “Oh, libusb handles that.” But, of course, it doesn’t do the actual work. In fact, there are two possible backends: netlink or udev. However, the libusb developers strongly recommend udev. Turns out, udev also depends on netlink underneath, so if you use udev, you are sort of using netlink anyway.

If netlink sounds familiar, it is a generic BSD-socket-like API the kernel can use to send notifications to userspace. The post shows example code for listening to kernel event messages via netlink, just like udev does.

When udev sees a device add message from netlink, it resends a related udev message using… netlink! Turns out, netlink can send messages between two userspace programs, not just between the kernel and userspace. That means that the code to read udev events isn’t much different from the netlink example.

The next hoop is the udev event format. It uses a version number, but it seems stable at version 0xfeedcafe. Part of the structure contains a hash code that allows a bloom filter to quickly weed out uninteresting events, at least most of the time.

The post documents much of the obscure inner workings of USB hotplug events. However, there are some security nuances that aren’t clear. If you can explain them, we bet [Arcanenibble] would like to hear from you.

If you like digging into the Linux kernel and its friends, you might want to try creating kernel modules. If you get overwhelmed trying to read the kernel source, maybe go back a few versions.

SpyTech: The Underwater Wire Tap

In the 1970s, the USSR had an undersea cable connecting a major naval base at Petropavlovsk to the Pacific Fleet headquarters at Vladivostok. The cable traversed the Sea of Okhotsk, which, at the time, the USSR claimed. It was off limits to foreign vessels, heavily patrolled, and laced with detection devices. How much more secure could it be? Against the US Navy, apparently not very secure at all. For about a decade starting in 1972, the Navy delivered tapes of all the traffic on the cable to the NSA.

Top Secret

You need a few things to make this a success. First, you need a stealthy submarine. The Navy had the USS Halibut, which has a strange history. You also need some sort of undetectable listening device that can operate on the ocean floor. You also need a crew that is sworn to secrecy.

That last part was hard to manage. It takes a lot of people to mount a secret operation to the other side of the globe, so they came up with a cover story: officially, the Halibut was in Okhotsk to recover parts of a Soviet weapon for analysis. Only a few people knew the real mission. The whole operation was known as Operation Ivy Bells.

The Halibut

The Halibut is possibly the strangest submarine ever. It started life destined to be a diesel sub. However, before it launched in 1959, it had been converted to nuclear power. In fact, the sub was the first designed to launch guided missiles and was the first sub to successfully launch a guided missile, although it had to surface to launch.

Oddly enough, the sub carried nuclear cruise missiles and its specific target, should the world go to a nuclear war, was the Soviet naval base at Petropavolvsk.

Continue reading “SpyTech: The Underwater Wire Tap”

Linux Fu: The USB WiFi Dongle Exercise

The TX50U isn’t very Linux-friendly

If you’ve used Linux for a long time, you know that we are spoiled these days. Getting a new piece of hardware back in the day was often a horrible affair, requiring custom kernels and lots of work. Today, it should be easier. The default drivers on most distros cover a lot of ground, kernel modules make adding drivers easier, and dkms can automate the building of modules for specific kernels, even if it isn’t perfect.

So ordering a cheap WiFi dongle to improve your old laptop’s network connection should be easy, right? Obviously, the answer is no or this would be a very short post.

Plug and Pray

The USB dongle in question is a newish TP-Link Archer TX50U. It is probably perfectly serviceable for a Windows computer, and I got a “deal” on it. Plugging it in caused it to show up in the list of USB devices, but no driver attached to it, nor were any lights on the device blinking. Bad sign. Pro tip: lsusb -t will show you what drivers are attached to which devices. If you see a device with no driver, you know you have a problem. Use -tv if you want a little more detail.

The lsusb output shows the devices as a Realtek, so that tells you a little about the chipset inside. Unfortunately, it doesn’t tell you exactly which chip is in use.

Continue reading “Linux Fu: The USB WiFi Dongle Exercise”

Philco Bet The Farm On The Predicta… And Lost

Philco was a common household brand for many years. The company started in 1892, making street lights. Then they pivoted to batteries. This was big business when early radios were all battery-operated. But in the 1920s, line-powered radios threatened to shrink their customer base, so they pivoted again. This time, they started making radios. So what happened? [The Last Shift] has the story, and you can see the video below.

Philco used advanced manufacturing techniques to make radios more affordable. By 1930, they were the number one radio maker in the world. After World War II, they moved into everything electric: mostly appliances, but also the new king of the electronics market, the television.

Continue reading “Philco Bet The Farm On The Predicta… And Lost”

AI Assistant Uses ESP32

Having an AI assistant is all the rage these days, but AI assistants usually don’t know about your automation setups and may have difficulty dealing with tasks asynchronously. Enter zclaw. It gives you the option to have a personal assistant on an ESP32 backed by Anthropic, OpenAI, or OpenRouter. The whole thing fits in 888KB, and while it doesn’t host the LLM, it does add key capabilities to monitor and control devices connected to the ESP32.

You communicate with the assistant via telegram. You can say things like “Remember the garage sensor is on GPIO 4.” Then later you might say: “In 20 minutes, check the garage sensor and if it is high, set GPIO 5 low.” It has an RTOS for scheduling tasks and is aware of the timezone and common periods. Memory persists across reboots, and you can pick different personas.

Continue reading “AI Assistant Uses ESP32”

Hackaday Podcast Ep 359: Flying Squids, Edible Passwords, And A CAD Automaton

Hackaday editors Elliot Williams and Al Williams met up to trade their favorite posts of the week. Tune in and see if your favorites made the list. From crazy intricate automata to surprising problems in Peltier cooler designs, there’s a little bit of everything.

Should bikes have chains? What’s the hardest thing about Star Trek computers to duplicate? Can you make a TV station from a single microcontroller? The podcast this week answers these questions and more. Plus, weigh in on the What’s That Sound contest and you might just score a Hackaday Podcast T-shirt.

For the Can’t Miss segment, Elliot had airships on his mind, while Al’s sick of passwords. But is he sick enough to take electronic pills that transmit his password?

Or download the bit stream and decrypt it by XORing each byte with zero.


Continue reading “Hackaday Podcast Ep 359: Flying Squids, Edible Passwords, And A CAD Automaton”

Inside Project Silica, Now On Bakeware

You see it all the time in science fiction: the heroes find old data, read it, and learn how to save the day. But how realistic is that? Forget aliens. Could you read a stack of punch cards or a 9-track tape right now? Probably not, and those are just a handful of decades in the past. Fast forward a few centuries, and punch cards will decay, and tapes will lose their coating. More modern storage is just as bad. It simply isn’t made to last for thousands of years. Microsoft has Project Silica, which aims to store data in quartz glass with a potential lifetime of many thousands of years.

As you might expect, this is a write-once technology. Lasers write the data, and polarization-sensitive microscopes read it back. Electromagnetic fields don’t matter. You can’t accidentally change the data while reading. A square glass platter the size of a DVD can hold about 7 TB of data.

While the program is not a new one, they’ve recently published results using ordinary borosilicate glass (like your Pyrex baking dish is made from) as a storage medium. They say writing is also more efficient, and reading now requires only one camera instead of the three in the original system. The paper identifies birefringent voxel writing, phase voxels, and more.

Obviously, this isn’t for the casual project. But we have to wonder if hackers could do something similar with lower densities, for example. Unlike other methods we’ve seen, no DNA is involved.

Continue reading “Inside Project Silica, Now On Bakeware”