  (Abridged) We present results of several X-ray observations of the X-ray
binary 4U 1954+31 performed with the satellites BeppoSAX, EXOSAT, ROSAT, RXTE,
and Swift. We also studied the RXTE ASM data over a period of more than 10
years. Light curves of all observations show an erratic behaviour with sudden
increases in the source emission on timescales variable from hundreds to
thousands of seconds. There are no indications of changes in the source
spectral hardness, with the possible exception of the RXTE pointed observation.
Timing analysis does not reveal the presence of coherent pulsations or
periodicities either in the pointed observations in the range from 2 ms to 2000
s or in the long-term RXTE ASM light curve on timescales from days to years.
The 0.2-150 keV spectrum, obtained with BeppoSAX, is the widest for this source
available to date in terms of spectral coverage and is well described by a
model consisting of a lower-energy thermal component (hot diffuse gas) plus a
higher-energy (Comptonization) emission, with the latter modified by a
partially-covering cold absorber plus a warm (ionized) absorber. A blackbody
modelization of our BeppoSAX low-energy data is ruled out. The presence of a
complex absorber local to the source is also supported by the 0.1-2 keV ROSAT
spectrum. RXTE, EXOSAT and Swift X-ray spectroscopy is consistent with the
above results, but indicates variations in the density and the ionization of
the local absorber. A 6.5 keV emission line is possibly detected in the
BeppoSAX and RXTE spectra. All this information suggests that the scenario that
better describes 4U 1954+31 consists of a binary system in which a neutron star
orbits in a highly inhomogeneus medium from a stellar wind coming from its
optical companion, an M-type giant star.
