laptop salvage pays off once again. last time i scrapped a laptop i salvaged the built in webcam thinking i would figure out how to talk to it one day. it was supposed to be a usb cam but the wiring was color coded all wrong and there were more wires than there should have been (6 instead of 4). upon closer inspection i realized that 2 of the wires were crimped together in the housing so it was actually 5 connections. the 5th wire was shield ground. unable to know which was which, i started looking at chips and writing down numbers. i identified one of the chips as an spi eeprom, looked up ids data sheet, and by testing continuity with each wire i was able to identify the grounds (the green one and the clear one).
that technique didnt work for the vcc, which wasnt directly connected to any of the wires. it did connect up with some kind of unmarked voltage regulator (chances are it dropped the 5v down to 3.3 as per usb spec), but without a datasheet i couldn't prove it. suspicion is useful though, so i looked at the first chip capacitor by the connector. this capacitor was likely for decoupling power from the bus, one side i tested against ground, and so i tested the other side against the other wires and found out that it was connected to the black and brown wires.

those colors are usually for ground. i tested against other capacitors (every chip usually gets one) to help confirm.
ultimately the thing that confirmed it was that the remaining wires were twisted together, you usually do that with differential pairs. their colors thew me off (they were red and orange, which are usually voltage source colors). i still had to determine which one was d+ and which was d-. i just used trial and error here. hooled it all up to a bread board and plug it in, didnt work the first time. i flipped the data lines, tried it again and it loaded a driver. a test later proves i have a working webcam. yay!
so all thats left is to figure out how to permanently connect a usb cable to it. the wires were very thin and short, so i couldn't just connect a cable to it. i saved the small plastic housing from the laptop. it had two peg holes on either side one which the wires came out and the other was just an open hole which once held a metal peg. so that gave me an idea. the peg hole was just big enough for a usb cable, and the end of the housing was mostly empty space. so what i did was potted the cable in one side with some hot glue. i took the camera pcb out, used some soldering flux to help take it apart. stuck the cable in there with a large portion of hot glue and waited. when i pulled it apart it molded to fit the case and bonded to the cable perfectly. i solder all the wires, close it up and superglue it shot. it works just fine.