Uploading Problems with the Arduino Robot: butterfly_recv(): programmer is not responding - arduino

I started working with the Arduino Robot Control Board a few days ago. I did a few tutorials and everything was fine. I could perfectly upload my programs using the Arduino IDE.
Today, I was working on a project and already did uploading, testing, adjusting, uploading again,... I pressed the Upload button and nothing happened and I got the following error message (with verbose output enabled):
Der Sketch verwendet 14960 Bytes (52%) des Programmspeicherplatzes. Das Maximum sind 28672 Bytes.
Globale Variablen verwenden 1539 Bytes (60%) des dynamischen Speichers, 1021 Bytes für lokale Variablen verbleiben. Das Maximum sind 2560 Bytes.
Erzwinge Reset durch öffnen/schließen mit 1200 bps auf dem Port /dev/ttyACM1
Beim Hochladen des Sketches ist ein Fehler aufgetreten
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
PORTS {/dev/ttyACM1, } / {/dev/ttyACM1, } => {}
Uploading using selected port: /dev/ttyACM1
/home/lukas/Dokumente/Arduino/arduino-1.8.5/hardware/tools/avr/bin/avrdude -C/home/lukas/Dokumente/Arduino/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -P/dev/ttyACM1 -b57600 -D -Uflash:w:/tmp/arduino_build_7255/Interrupts.ino.hex:i
avrdude: Version 6.3, compiled on Jan 17 2017 at 06:01:25
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/home/lukas/Dokumente/Arduino/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf"
User configuration file is "/home/lukas/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyACM1
Using Programmer : avr109
Overriding Baud Rate : 57600
AVR Part : ATmega32U4
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 9000 9000 0x00 0x00
flash 65 6 128 0 yes 32768 128 256 4500 4500 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : butterfly
Description : Atmel AppNote AVR109 Boot Loader
Connecting to programmer: .avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
Found programmer: Id = "�"; type = �
Software Version = Y.�; Hardware Version = .
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: leave prog mode
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: exit bootloader
I did check the connection, made sure, that the USB cable is not broken. I actually can use the IDE to upload programs to the lower Motor Board, so it's not the IDE's fault, I assume. But as I am fairly new to the Arduino World, I am quite clueless now.
I read a lot of forum posts, but I couldn't find a working solution. Similiar problems seem to happen to others as well, but for other Arduino platforms. Those answers did not solve my problem, including the Arduino Forum itself.
I am currently on Lubuntu 16.04.3 LTS or Windows 10. The same problem is on both OSes.

Related

How to connect to password enabled BLE sensor?

I'm using Minew S1 Humidity and Temperature sensor with raspberry Pi, initially this sensor is password enabled, so how can I connect it to Humidity Sensor with Raspberry Pi using bluetoothctl or gatttool.
Edited:
< ACL Data TX: Handle 64 flags 0x00 dlen 7 #52 [hci0] 23.727179
ATT: Read Request (0x0a) len 2
Handle: 0x0027
> HCI Event: Number of Completed Packets (0x13) plen 5 #53 [hci0] 23.775948
Num handles: 1
Handle: 64
Count: 2
> HCI Event: Disconnect Complete (0x05) plen 4 #54 [hci0] 32.502249
Status: Success (0x00)
Handle: 64
Reason: Remote User Terminated Connection (0x13)
# MGMT Event: Device Disconnected (0x000c) plen 8 {0x0001} [hci0] 32.502320
LE Address: AC:23:3F:AB:7B:D8 (Shenzhen Minew Technologies Co., Ltd.)
Reason: Connection terminated by remote host (0x03)
Thank you

How to make grafana on nixos available in local network

My laptop and my nixos-server (hostname=nixos) are both conected to my router (fritz.box). I can access the rooter via ping (ping nixos.fritz.box) and ssh (ssh username#nixos.fritz.box).
What I want is to follow the first part of this guide to set up grafana on nixos. I then want to be able to access grafana from my laptop.
On the server I have configured nixos to run both grafana and a reverse proxy (nginx):
services.grafana = {
enable = true;
domain = "grafana.nixos.fritz.box";
port = 2342;
addr = "127.0.0.1";
};
# nginx reverse proxy for grafana
services.nginx.virtualHosts.${config.services.grafana.domain} = {
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}";
proxyWebsockets = true;
};
};
# Open ports for http and https
networking.firewall.allowedTCPPorts = [ 80 443 ];
system.stateVersion = "21.03";
Unfortunatelly I can't access the grafana webinterface from my laptop.
I tried changing around the value of services.grafana.domain and what I type into my browser (firefox/curl), here is what I got:
services.grafana.domain
argument of curl
output of curl
grafana.nixos.fritz.box
http://grafana.nixos.fritz.box/
curl: (6) Could not resolve host: grafana.nixos.fritz.box
grafana.nixos.fritz.box
https://grafana.nixos.fritz.box/
curl: (6) Could not resolve host: grafana.nixos.fritz.box
grafana.nixos.fritz.box
http://nixos.fritz.box/
curl: (52) Empty reply from server
grafana.nixos.fritz.box
https://nixos.fritz.box/
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to nixos.fritz.box:443
nixos.fritz.box
http://nixos.fritz.box/
curl: (52) Empty reply from server
nixos.fritz.box
https://nixos.fritz.box/
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to nixos.fritz.box:443
grafana.localhost
(on the server) http://grafana.localhost
curl: (7) Failed to connect to grafana.localhost port 80: Connection refused
grafana.localhost
(on the server) https://grafana.localhost
curl: (7) Failed to connect to grafana.localhost port 443: Connection refused
Especially the last 2 lines leave me perplexed.
netstat -an | grep LISTEN on the server gives me this:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:2342 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
unix 2 [ ACC ] STREAM LISTENING 1837 /run/systemd/private
unix 2 [ ACC ] STREAM LISTENING 1841 /run/systemd/userdb/io.systemd.DynamicUser
unix 2 [ ACC ] SEQPACKET LISTENING 1853 /run/systemd/coredump
unix 2 [ ACC ] STREAM LISTENING 1862 /run/systemd/journal/stdout
unix 2 [ ACC ] SEQPACKET LISTENING 1868 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 26958 /var/run/nscd/socket
unix 2 [ ACC ] STREAM LISTENING 1905 /run/systemd/journal/io.systemd.journal
unix 2 [ ACC ] STREAM LISTENING 12193659 /run/user/1001/bus
unix 2 [ ACC ] STREAM LISTENING 12205464 /run/user/1001/systemd/private
unix 2 [ ACC ] STREAM LISTENING 13312 /nix/var/nix/daemon-socket/socket
unix 2 [ ACC ] STREAM LISTENING 18416 /var/run/dhcpcd.sock
unix 2 [ ACC ] STREAM LISTENING 18418 /var/run/dhcpcd.unpriv.sock
unix 2 [ ACC ] STREAM LISTENING 13308 /run/dbus/system_bus_socket
I don't know how to make grafana available in the local network. Can someone help me with that, please?
(I know this question is somewhat similar to this one, but the solution there doesn't help me)
Adding the following line solved my problem (thanks to #Tch):
services.nginx.enable = true;

Puzzled about the `telnet localhost` and `telnet 0.0.0.0`

I wrote a simple GO program which listens to 0.0.0.0:9999 and 127.0.0.1:9999:
func main() {
go bind("0.0.0.0:9999", "111 ")
go func() {
time.Sleep(2 * time.Second)
bind("127.0.0.1:9999", "222 ")
}()
time.Sleep(time.Hour)
}
func bind(address string, content string) {
fmt.Println("-------------", address, "-----------------")
listener, err := net.Listen("tcp", address)
if err != nil {
panic(err)
return
}
fmt.Println(listener.Addr().String())
conn, _ := listener.Accept()
for {
_, err := conn.Write([]byte(content))
if err != nil {
panic(err)
}
time.Sleep(1 * time.Second)
}
}
The meaning of the code:
It binds two addresses, and gives different responses to the clients of them
binding "0.0.0.0:9999": will send "111 " repeat to client
binding "127.0.0.1:9999": will send "222 " repeat to client
And then I use telnet to try different addresses, and the responses are:
telnet 127.0.0.1 9999: 222 (OK)
telnet localhost 9999: 111 (WHY?!)
telnet 0.0.0.0 9999: 222 (WHY?!)
telnet <my-internal-ip> 9999: 111 (OK)
I'm quite confused about some of them:
telnet localhost 9999: 111 (WHY?!)
localhost should point to 127.0.0.1, so I think it's same to telnet 127.0.0.1 9999 and the response should be 222, but the actual one is 111
telnet 0.0.0.0 9999: 222 (WHY?!)
I think 0.0.0.0 is not same to 127.0.0.1, I expect to get response of 111, but get 222
I also have a demo project: https://github.com/golang-demos/go-bind-0.0.0.0-127.0.0.1-demo
Update: My os is OSX
Both localhost and 0.0.0.0 are resolved to 127.0.0.1 by the OS
$ ping 0.0.0.0
PING 0.0.0.0 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.024 ms
$ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.035 ms`
localhost could resolve to something else depending on /etc/hosts file.
An excellent explanation for Linux ping 0.0.0.0 behavior is here.

High TIME_WAIT and Unable to get return job id from salt minion

On salt master(Ubuntu 14.04):
# salt '*' test.ping or execute some state files,
I can see the screen hangs up like below message and can't get the job id return from the minion.
[DEBUG ] Using cached minion ID from /etc/salt/minion_id: ranjith1.times.com
[DEBUG ] Missing configuration file: /root/.saltrc
[DEBUG ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc
[DEBUG ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc
[DEBUG ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/master', 'ranjith1.times.com_master', 'tcp://192.168.233.3:4506', 'clear')
[DEBUG ] Initializing new IPCClient for path: /var/run/salt/master/master_event_pub.ipc
[DEBUG ] LazyLoaded local_cache.get_load
[DEBUG ] Reading minion list from /var/cache/salt/master/jobs/58/763acd820353b8a744c7a7167c62f2/.minions.p
[DEBUG ] get_iter_returns for jid 20161007154243656981 sent to set(['gr-test.foreman.in']) will timeout at 16:07:43.662608
# netstat shows,
Every 2.0s: netstat -antp | grep 4506
Fri Oct 7 15:37:18 2016
tcp 0 0 192.168.233.3:4506 0.0.0.0:* LISTEN 1591/python
tcp 0 0 192.168.233.3:34619 192.168.233.3:4506 TIME_WAIT -
tcp 0 0 192.168.233.3:34620 192.168.233.3:4506 TIME_WAIT -
tcp 0 0 192.168.233.3:34622 192.168.233.3:4506 TIME_WAIT -
tcp 0 0 192.168.233.3:34621 192.168.233.3:4506 TIME_WAIT -
tcp 0 0 192.168.233.3:34617 192.168.233.3:4506 TIME_WAIT -
tcp 0 0 192.168.233.3:34616 192.168.233.3:4506 TIME_WAIT -
tcp 0 0 192.168.233.3:34618 192.168.233.3:4506 TIME_WAIT -
tcp 0 0 192.168.233.3:34623 192.168.233.3:4506 TIME_WAIT -
changed the below values from:
# cat /proc/sys/net/ipv4/tcp_tw_recycle
0
# cat /proc/sys/net/ipv4/tcp_tw_reuse
0
# cat /proc/sys/net/ipv4/tcp_fin_timeout
60
# cat /proc/sys/net/ipv4/ip_local_port_range
32768 61000
to:
# cat /proc/sys/net/ipv4/ip_local_port_range
15000 65000
# cat /proc/sys/net/ipv4/tcp_fin_timeout
30
but still i can see the time_wait, kindly suggest what else need to do on server side(ubuntu) or in the salt-master configuration to short this issue.

Generic keyboard emulation using Arduino Leonardo

I am trying to use an Arduino Leonardo for keyboard emulation since that is one of its advertised features. I have been playing with the Leonardo and wrote a very simple sketch based off the Blink example.
// Pin 13 has an LED connected on most Arduino boards.
int led = 13;
// The setup routine runs once when you press reset:
void setup()
{
// Initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// The loop routine runs over and over again forever:
void loop()
{
delay(5000); // Wait for five seconds
digitalWrite(led, HIGH); // Turn the LED on (HIGH is the voltage level)
delay(100); // Wait for a secondA
digitalWrite(led, LOW); // Turn the LED off by making the voltage LOW
Keyboard.write('A'); // Write an A using keyboard emulator
}
Now this example works great on my Windows XP machine. It is recognized as a generic HID keyboard and will type an 'A' every five seconds.
The targeted environment is running DOS so to my knowledge I need to get the Arduino Leonardo recognized by the BIOS on this machine, which it is not and it does not type the 'A' in DOS.
I have been making modifications to the USB device descriptor of the Leonardo, trying to make it match a Dell L100 as much as possible. The modifications I've made haven't helped, and I suspect it is because the Leonardo is a composite device which exposes the serial communication, keyboard emulation, and mouse emulation on the same USB port. The source code for the USB descriptors/configuration is available to be edited and is located at:
Arduino_Installation\hardware\arduino\cores\arduino\HID.cpp
Arduino_Installation\hardware\arduino\cores\arduino\USBDesc.h
Arduino_Installation\hardware\arduino\cores\arduino\USBCore.h
Arduino_Installation\hardware\arduino\cores\arduino\USBCore.cpp
The following is a dump from USB Device Viewer for the Leonardo:
[Port3] : USB Composite Device
---===>Device Information<===---
English product name: "Arduino Leonardo"
ConnectionStatus:
Current Config Value: 0x01 -> Device Bus Speed: Full
Device Address: 0x03
Open Pipes: 4
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x81 -> Direction: IN - EndpointID: 1
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0010 = 0x10 bytes
bInterval: 0x40
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x02 -> Direction: OUT - EndpointID: 2
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x83 -> Direction: IN - EndpointID: 3
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x84 -> Direction: IN - EndpointID: 4
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x01
===>Device Descriptor<===
bLength: 0x12
bDescriptorType: 0x01
bcdUSB: 0x0110
bDeviceClass: 0x00
*!*ERROR: device class should be Multi-interface Function 0xEF
When IAD descriptor is used
bDeviceSubClass: 0x00
*!*ERROR: device SubClass should be USB Common Sub Class 2
When IAD descriptor is used
bDeviceProtocol: 0x00
*!*ERROR: device Protocol should be USB IAD Protocol 1
When IAD descriptor is used
bMaxPacketSize0: 0x40 = (64) Bytes
idVendor: 0x2341 = Vendor ID not listed with USB.org as of 03-19-2008
idProduct: 0x8036
bcdDevice: 0x0100
iManufacturer: 0x01
English (United States) "Arduino LLC"
iProduct: 0x02
English (United States) "Arduino Leonardo"
iSerialNumber: 0x00
bNumConfigurations: 0x01
===>Configuration Descriptor<===
bLength: 0x09
bDescriptorType: 0x02
wTotalLength: 0x0064 -> Validated
bNumInterfaces: 0x03
bConfigurationValue: 0x01
iConfiguration: 0x00
bmAttributes: 0x80 -> Bus Powered
MaxPower: 0xFA = 500 mA
===>IAD Descriptor<===
bLength: 0x08
bDescriptorType: 0x0B
bFirstInterface: 0x00
bInterfaceCount: 0x02
bFunctionClass: 0x02 -> This is Communications (CDC Control) USB Device Interface Class
bFunctionSubClass: 0x01
bFunctionProtocol: 0x01
iFunction: 0x00
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x01
bInterfaceClass: 0x02 -> This is Communications (CDC Control) USB Device Interface Class
bInterfaceSubClass: 0x01
bInterfaceProtocol: 0x00
CAUTION: This may be an invalid bInterfaceProtocol
iInterface: 0x00
-> This is a Communications (CDC Control) USB Device Interface Class
===>Descriptor Hex Dump<===
bLength: 0x05
bDescriptorType: 0x24
05 24 00 10 01
-> This is a Communications (CDC Control) USB Device Interface Class
===>Descriptor Hex Dump<===
bLength: 0x05
bDescriptorType: 0x24
05 24 01 01 01
-> This is a Communications (CDC Control) USB Device Interface Class
===>Descriptor Hex Dump<===
bLength: 0x04
bDescriptorType: 0x24
04 24 02 06
-> This is a Communications (CDC Control) USB Device Interface Class
===>Descriptor Hex Dump<===
bLength: 0x05
bDescriptorType: 0x24
05 24 06 00 01
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x81 -> Direction: IN - EndpointID: 1
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0010 = 0x10 bytes
bInterval: 0x40
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x01
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x0A -> This is a CDC Data USB Device Interface Class
bInterfaceSubClass: 0x01
bInterfaceProtocol: 0x00
CAUTION: This may be an invalid bInterfaceProtocol
iInterface: 0x00
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x02 -> Direction: OUT - EndpointID: 2
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x83 -> Direction: IN - EndpointID: 3
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x02
bAlternateSetting: 0x00
bNumEndpoints: 0x01
bInterfaceClass: 0x03 -> HID Interface Class
bInterfaceSubClass: 0x01
bInterfaceProtocol: 0x00
CAUTION: This may be an invalid bInterfaceProtocol
iInterface: 0x00
===>HID Descriptor<===
bLength: 0x09
bDescriptorType: 0x21
bcdHID: 0x0101
bCountryCode: 0x00
bNumDescriptors: 0x01
bDescriptorType: 0x22
wDescriptorLength: 0x0065
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x84 -> Direction: IN - EndpointID: 4
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x01
How could I get this Leonardo recognized by a BIOS as a generic keyboard?
Arduino does not support the boot protocol. I have started using Teensy (which is Arduino compatible), and it works pretty well.
I might be mistaken, but if you want your device to be recognized during boot, its bInterfaceSubClass should be 0x01 (boot device subclass).
In source files, as you have pointed out, sub class is set to 0x00 everywhere.
You may try to set the subclass in all usages of the D_INTERFACE macro from file USBCore.h to 0x01.
I'm not an Arduino user. I was only once playing with HID keyboard emulation on AVR using V-USB. You can try to find detailed information about usb descriptors at USB.org in documentation. But it's quite a pile of pages to read.
Here is part od HID descriptor dump of my keyboard, notice values in Interface Descriptor:
Bus 005 Device 002: ID 046d:c30e Logitech, Inc. UltraX Keyboard (Y-BL49)
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x046d Logitech, Inc.
idProduct 0xc30e UltraX Keyboard (Y-BL49)
bcdDevice 1.80
iManufacturer 1 Logitech
iProduct 2 HID compliant keyboard
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 59
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 62
The dump was made using "lsusb -v" as root under Linux.

Resources