On a Lenovo ThinkPad T430 (2342-CTO) with kernel 4.10.1 (and presumably earlier) the "docked" sysfs file always contains 0 for both the ata_bay and battery_bay dock devices (the only dock devices present). This holds true with either a hard drive or DVD drive in the UltraBay both at boot and after hotplug.
I reported the issue on the linux-acpi mailing list and am filing it here for tracking.
Let me know if an acpidump or any other information would be helpful to debug.
yes, acpidump would be helpful.
Created attachment 255583 [details]
acpidump for Lenovo ThinkPad T430 (2342-CTO) with BIOS G1ETB2WW (2.72)
Does this patch:
make any difference?
With patch https://patchwork.kernel.org/patch/9674333/ applied to b9b3322f13f3 the "docked" sysfs file for the ata_bay dock correctly shows 1 when either a DVD or HD drive is present and 0 when empty, both on boot and after removal/reinsertion.
The "docked" sysfs file for the battery_bay dock device still always shows 0 whether or not the main battery is connected. However, upon further reflection, I think this is the expected behavior, assuming the battery_bay dock device refers to the battery connector in the UltraBay slot and that there is no dock device to represent the main battery. (I do not have a battery for the UltraBay slot to test.)
So I think that patch fully fixes the issue. Thanks!