What exactly do you have to program to make HID mouse, keyboard, device...

I know you have to write a driver, I already read the USB 3.0 specification, I still want to know what you have to program in an *.ino file to have the computer recognize the USB arduino connection as a HID device, mouse, keyboard, etc. I think there is a very easy and straight way to achieve it but I am missing it. I can see you have to provide some strings, memory in arduinos would be needed precisely for such requirement, otherwise just output signals and that is it. If I go to *.inf files I find a tree naming convention that is barely understandable. In other interfaces I find the vendor name string and device type strings. You should be able to omit writing a driver if you are posing your arduino as a generic. So for instance something so simple as sending mouse input for a bounded rectangle, how do you achieve it? The USB spec should be easy to follow but IT IS NOT. USB 3.0 is mixed with remindings about USB 2.0 and lots of still-to-be-adopted/still-to-be-implemented sections and references to state machines incompletely written or not written at all. Is there a library already there for arduino? I want to use arduino nano to get myself a better mouse for some circumstances, particularly, to leave the laptop alone and be around while controlling it automatically for bypassers who might peek in it. So what do I have to start with in an arduino to make the USB components in Windows understand it is a mouse?

The really simple way is to buy an Arduino like the Arduino Micro that has an ATmega32U4 MCU. This chip has a native (built in) USB controller so it is simple to use Keyboard/Mouse commands.

Micro? I got Nano, with a chip clone CH340, is that what you mean? Still, I do not know what (nor where) add the required strings. I understand somewhere I have to say GENERIC to get the OS use a generic type driver, but of course I d like to use my own vendor string, though anything satisfying the requirement would be OK, it is only a convenience I need for my laptop usage.

syntotic:
Micro? I got Nano, with a chip clone CH340, is that what you mean?

If Riva meant Nano don't you think they would have said Nano? Please take the time to actually read the links that Riva shared, then you will understand what we're talking about. The Nano has an ATmega328P microcontroller, which is generally a very good microcontroller but the ATmega32U4 on the Micro/Pro Micro/Leonardo is specially designed for what you want to do. It's slightly more expensive thzn the Nano but will make your job much easier. I use the Pro Micro boards for this purpose because they're the smallest ATmega32U4 board. Clones are available on eBay, such as:
www.ebay.com/itm/291877524679
You can get them a bit cheaper on Aliexpress but the shipping and customer service is terrible on that site.
The Micro and Leonardo boards will also work and have their own advantages.

Puff! I did say in my question: I want to use nano. It is what I have and can get easily, so any other suggestion is off toping. That is reading a question. And it is still unanswered, I want to know EXACTLY what you have to program to have the microcontroller be understood as a HID device. This means to start with a pair of strings of which I am unsure. I use Windows and it has the USB ports very well handled, something turns on when I insert and it works. It is expecting something protocol to decide what kind of device it is and announce it in the device manager, at least. HID is a convention, so I want to know how to make my arduino nano participate in the convention without going through the IDE. If well done, Windows will say NOTHING and will start communicating through drivers with a conventional device, which is when I can start the programming I need in itself.

Puff! I did say in my question: I want to use nano. It is what I have and can get easily, so any other suggestion is off toping.

No, it is not. There are some boards that have the necessary hardware. There are some that don't. Pigs don't have wings. They can't fly, no matter how much they want to. Boards without the necessary hardware can NOT act as HID device, no matter how much you want to fly like a pig.

syntotic:
Puff! I did say in my question: I want to use nano. It is what I have and can get easily

Well I don't think that's a good enough reason to jump into the confusing world of USB when you can get the ATmega32U4 boards shipped to you anywhere in the world. However, if you want to do it for the sake of learning that is a valid reason. Sometimes it's just fun to do things the hard way.

syntotic:
something turns on when I insert and it works. It is expecting something protocol to decide what kind of device it is and announce it in the device manage

The problem is that's not being done on the ATmega328P. That's happening on the USB-serial chip which creates the virtual com port. Most likely you are using a clone Nano which uses the CH340 chip for this purpose. My understanding is that chip is specifically designed for that purpose alone and there is no way to implement HID on it. There is a way to implement HID on Arduino boards that use an ATmega16U2 or similar for the USB-serial chip because that chip is programmable:

However, I'm not aware of any Nano that uses those chips for the USB-serial interface. The official Nanos use FTDI FT232 and the clones use CH340. This means you would need to implement HID on the ATmega328P. You won't be able to use the USB jack on the Nano as is. You will need to wire a separate USB jack to some of the Nano's pins. The other option would be to remove the CH340 and use some magnet wire to connect the ATmega328p's pins to the pads connected to the data pins on the on-board USB jack, which will cause you to lose the 3V3 pin. You might need to add some passives too. On the software side I believe the most common options are V-USB and LUFA. Have fun!

syntotic:
Puff! I did say in my question: I want to use nano. It is what I have and can get easily, so any other suggestion is off toping. That is reading a question. And it is still unanswered, I want to know EXACTLY what you have to program to have the microcontroller be understood as a HID device.

Well, as you really really insist on using the Nano as a USB HID device then be prepared to break out your soldering iron as the only way to do this is by adding some external hardware components (2x 3.6v zener diodes, 2x 68R resistors, 2.2k resistor & a USB socket/plug). You will also need to do some research on how to either convert LUFA or V-USB to suit your needs or if you invoke Google you may luck out and find a tutorial on how to do it.
Good luck with you project though.

OK, I think this does it while I assimilate it. But I still rather have a two strings reply.