His nails are trimmed, so that's not a problem.
I took him back to the vet today. He had a test for mites and he doesn't have them.
The vet took samples from his ears to do a test if it's a kind of fungus or not - it will take a week or so to get results.
In the meantime I asked for some medicine to rub on his ears to treat them, so I'll update how that goes and if it is a fungal infection or not.