Your passport could very well be checked if you're crossing from Austria to Germany.  I had such an experience in Freilassing in June, the train had stopped, I had dozed off.    The Bavarian police appeared,  asked me for my Passport in German, surprisingly.   (the 2nd time that happened when crossing the Salzburg-Munich corridor.)   The first time was in 2015.
No scanning but they will flip through the pages, it isn't really  a cursory glance either.  They're looking for more than  merely  your name and photo.  (I didn't know that in 2015, this time I was prepared to deal with them as I knew what they were after).    The one guy asking  the questions as he was flipping through the pages of  my US passport asked me if I spoke English (which really ticked me off).  I  just shot back the answer at him. 
I noticed  whenever  I made a border crossing between Germany and  Austria  at another  point / location  other than the Munich-Salzburg corridor  I never encountered  a passport check, day or night.