The chemisorption of hydrogen on graphene or graphite is studied within a quantum formalism involving a subsystem coupled to a phonon bath. The subsystem includes the hydrogen atom approaching the surface perpendicularly right on top of a carbon atom which puckers out of the surface. The bath includes the acoustic and optical phonon modes vibrating perpendicularly to the surface. Couplings between subsystem and bath are obtained with a periodic density functional theory calculation. Trapping probabilities are obtained as a function of the hydrogen atom kinetic energy. These results are discussed in the light of the experimental hydrogenation studies performed on graphite by Zecho et al. [J. Chem. Phys. 117, 8486 (2002)] and on graphene by Haberer et al. [Adv. Mater. 23, 4497 (2011)].