Great guesses! The second response looks perfect to me :) One of the difficult things about English is the order of words in questions. Basically, there are two types of questions: 1) "wh-" questions and 2) "yes/no" questions. In a "wh-" question, we use a question word like "who", "what", "where", when", "why", or "how" (I know, I know, there's no "wh-" in "how" ...). When we ask a "wh-" question, we expect as an answer some particular CONTENT: a name, a thing, a place, etc. In the other type of question (a "yes/no" question), we DON'T use one of these question words; and, we expect either "yes" or "no" as an answer.
You did great with the "wh-" question (the second one). Let's see how it works:
In the statement, we start with the subject, then comes the verb, and then comes the object (if there is one). For example:
"You were doing something."
In the question, on the other hand, we put the "wh-" word first and then we SWITCH the order of the subject and the (first) verb. So:
"What were you doing?"
BUT (as you correctly observed in your answer), when we form the "reported speech" version, we DON'T switch the subject and verb. So:
"I asked you what you were doing."
So good job!
Now let's look at "yes/no" questions. In a "yes/no" question we don't have any question word. ALL we can do is switch the order of the subject and the (first) verb. Let's start with the statement:
"The lesson has started."
To form a question, we switch the order of the subject ("the lesson") and the first verb ("has"). So that gives us:
"Has the lesson started?"
Finally, let's consider the "reported speech" version. This is (almost) just like the other reported speech example. Here, too, we DON'T switch the order of the subject and the verb. BUT, we DO need to add something. In regular speech, we use the word "if". In more formal speech (or writing), we use the word "whether". So that would give us sentences like:
"The student is asking if the lesson has started."
"The student is asking whether the lesson has started."
In your example, however, the "asking" took place in the past. So you were very wise to change "has" to "had", since we are referring to a time even further back in time. So, when we change the tense, we get sentences like:
"The student asked if the lesson had started."
"The student asked whether the lesson had started."
I hope this helps! Please feel free to ask me more questions ("wh-" or "yes/no"), if you have them!