The relationship between photosynthetic and chemosynthetic bacteria appears to be that chemosynthetic bacteria evolved into photosynthetic bacteria. Then chemosynthetic bacteria adjusted to aerobic environment by harnessing the reduction reaction.
A model has been proposed by John Corliss concerning how life would have evolved in a vent. The theory is that deep down in a vent the temperatures and chemistry would have been right to form organic compounds. As the simple compounds made their way up the vent they would form amino acids, RNA and then DNA. Clay or Zeolites along the vent wall would form a catalyst for the reactions to take place. Closer to the surface it is expected that sugars and other compounds would have formed and at the top of the vent primitive hetrotrophic cells would have evolved. The hetrotrophic cells then would have fed off of the organic compounds been produced by the vent. When competition became to great at the vent mouth genetic mutation that favoured food production from carbon dioxide would enable hetrotrophic cells to evolve into autotrophs.
A possible chemical reaction fuelling food production would have been the conversion of hydrogen and carbon dioxide to methane. Eventually these autotrophic cells converted to photosynthesis and oxygenated the atmosphere.
Sources: K. Condie, BRIDGE