OK I think your question title is a bit unintentionally misleading, since in the text you're saying you've already found the device and are asking how to programmatically do so. One question that comes to mind is how you manually found it and why you couldn't just script around it. I'll answer the question as best I can in its current form, apologies in advance if I miss the mark.
Stuff like this is incredibly variable and device-specific. It's considerations like this that require drivers/software adapters even in higher level software. So you should probably get used to the idea that this script will do this one particular thing rather than abstracting out to some generic process (which is what I'm guessing you're trying to do).
As a bit of background: Each bus-like system (USB, SCSI, PCI, etc) needs some form of addressing devices. With
lspci these are the values you see on the leftmost of each line in the default output.
[root@hypervisor pyadmin]# lspci
00:00.0 Host bridge: Intel Corporation 5400 Chipset Memory Controller Hub (rev 20)
00:1d.1 USB controller: Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #2 (rev 09)
00:1d.2 USB controller: Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #3 (rev 09)
04:00.0 PCI bridge: Intel Corporation 6311ESB/6321ESB PCI Express Downstream Port E1 (rev 01)
04:01.0 PCI bridge: Intel Corporation 6311ESB/6321ESB PCI Express Downstream Port E2 (rev 01)
07:05.0 Fibre Channel: QLogic Corp. ISP2422-based 4Gb Fibre Channel to PCI-X HBA (rev 02)
07:06.0 Fibre Channel: QLogic Corp. ISP2422-based 4Gb Fibre Channel to PCI-X HBA (rev 02)
08:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5754 Gigabit Ethernet PCI Express (rev 02)
The PCI addresses are the 08:00.0, 07:06.0, etc.
As you said, the sysfs directory you're looking at is for one of the modules (
usbled) so you're looking at the information sysfs has on that module, which includes devices that use the module (or vice versa, if you like). The
1-1.2:1.0 you're looking at represents the device and is being referenced by it's USB Address (in USB terminology the "endpoint").
So if you already know the module, I would basically filter out the known values and only search for dentry's that contain both colons and periods, as there's very little chance of another dentry in that particular
sysfs directory ever being created with a name like that if it's not a connected device.
I know that's a little all over the place, but I'm pretty sure your answer's up there somewhere.