I was able to work around the issue not by changing things at the Android end but by changing the class of the bluetooth adapter. I know this doesn't solve the original issue of class 0x00 devices being blocked, but at least you can use a BT serial device with android despite the bug.
I bought a Bluetooth serial converter from ebay (link here: http://www.ebay.co.uk/itm/Bluetooth-RS232-serial-Converter-Module-Adapter-Board-/190508188703?pt=LH_DefaultDomain_0&hash=item2c5b2c441f ) which, as expected, wasn't recognized by my HTC Desire in its default configuration.
I didn't want to try the app by Zorn software mentioned above, because some people reported it messing up their HTC phones. Instead, I found from the BT device's AT commands datasheet that you can change, among other parameters, the device's class number by using an UART connection and a terminal program.
It took me a while to figure out that you can't use the Bluetooth serial connection to access the configuration interface, but that you must use the physical RX and TX pins on the device instead. You also need to connect the pin named "Key" to Vcc to activate the command mode. So I used an AVR serial programmer device's RS232 to UART interface to connect to the RX/TX pins and used Realterm as the terminal program. This got the AT command interface working once I had the right baudrate, 38400, and swapped the RX and TX leads which I initially connected the wrong way around.
I used the generator here
http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html
to get a valid non-zero class number (I used object transfer/computer/desktop workstation, which amounts to 0x100104), and entered it to the device with the command
at+class=100104
where
indicates Enter (see the datasheet).
After switching the BT adapter off, disconnecting the "Key" pin and switching on again, I was able to pair it with my phone the normal way. Data transfer also worked. I again used the AVR programmer's UART and Realterm to send some data (a Hello World message in ASCII) to the RX/TX pins of the adapter. In the Android end, I used the app SENA Bterm to receive the data.
I hope this helps someone do interesting things with their phones and embedded systems.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…