Openstack VM instance SHUTOFF after few minute - virtual-machine
For learning purpose i have build openstack on VirtualBox with 2 vCPU and 4GB Memory. It installed successfully and i am able to start VM instances but what happened is guest VM got SHUTOFF status after few minutes. I have google this issue but didn't get proper answer. I have check logs and i didn't find anything suspicious.
How do i check VM console so i can see what is going on there?
Where should i check SHUTOFF specific error logs, i meant in which file?
EDIT:
Following is output of nova console-log but it stuck there not going ahead and i can't see login screen too
openstack#openstack1:~$ nova console-log 970a3722-0fb3-4db6-862b-2aa626cc68a8
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.0.0-12-virtual (buildd#crested) (gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) ) #20-Ubuntu SMP Fri Oct 7 18:19:02 UTC 2011 (Ubuntu 3.0.0-12.20-virtual 3.0.4)
[ 0.000000] Command line: LABEL=cirros-rootfs ro console=tty0 console=ttyS0 console=hvc0
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
[ 0.000000] BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: 0000000000000000 - 000000000009dc00 (usable)
[ 0.000000] BIOS-e820: 000000000009dc00 - 00000000000a0000 (reserved)
[ 0.000000] BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
[ 0.000000] BIOS-e820: 0000000000100000 - 000000001fffd000 (usable)
[ 0.000000] BIOS-e820: 000000001fffd000 - 0000000020000000 (reserved)
[ 0.000000] BIOS-e820: 00000000fffc0000 - 0000000100000000 (reserved)
[ 0.000000] NX (Execute Disable) protection: active
[ 0.000000] DMI 2.4 present.
[ 0.000000] No AGP bridge found
[ 0.000000] last_pfn = 0x1fffd max_arch_pfn = 0x400000000
[ 0.000000] x86 PAT enabled: cpu 0, old 0x7040600070406, new 0x7010600070106
[ 0.000000] found SMP MP-table at [ffff8800000fdaf0] fdaf0
[ 0.000000] init_memory_mapping: 0000000000000000-000000001fffd000
[ 0.000000] RAMDISK: 1fdf9000 - 1ffed000
[ 0.000000] ACPI: RSDP 00000000000fd990 00014 (v00 BOCHS )
[ 0.000000] ACPI: RSDT 000000001fffd7b0 00034 (v01 BOCHS BXPCRSDT 00000001 BXPC 00000001)
[ 0.000000] ACPI: FACP 000000001fffff80 00074 (v01 BOCHS BXPCFACP 00000001 BXPC 00000001)
[ 0.000000] ACPI: DSDT 000000001fffd9b0 02589 (v01 BXPC BXDSDT 00000001 INTL 20100528)
[ 0.000000] ACPI: FACS 000000001fffff40 00040
[ 0.000000] ACPI: SSDT 000000001fffd910 0009E (v01 BOCHS BXPCSSDT 00000001 BXPC 00000001)
[ 0.000000] ACPI: APIC 000000001fffd830 00072 (v01 BOCHS BXPCAPIC 00000001 BXPC 00000001)
[ 0.000000] ACPI: HPET 000000001fffd7f0 00038 (v01 BOCHS BXPCHPET 00000001 BXPC 00000001)
[ 0.000000] No NUMA configuration found
[ 0.000000] Faking a node at 0000000000000000-000000001fffd000
[ 0.000000] Initmem setup node 0 0000000000000000-000000001fffd000
[ 0.000000] NODE_DATA [000000001fff5000 - 000000001fff9fff]
[ 0.000000] Zone PFN ranges:
[ 0.000000] DMA 0x00000010 -> 0x00001000
[ 0.000000] DMA32 0x00001000 -> 0x00100000
[ 0.000000] Normal empty
[ 0.000000] Movable zone start PFN for each node
[ 0.000000] early_node_map[2] active PFN ranges
[ 0.000000] 0: 0x00000010 -> 0x0000009d
[ 0.000000] 0: 0x00000100 -> 0x0001fffd
[ 0.000000] ACPI: PM-Timer IO Port: 0xb008
[ 0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[ 0.000000] ACPI: IOAPIC (id[0x01] address[0xfec00000] gsi_base[0])
[ 0.000000] IOAPIC[0]: apic_id 1, version 17, address 0xfec00000, GSI 0-23
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[ 0.000000] Using ACPI (MADT) for SMP configuration information
[ 0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[ 0.000000] SMP: Allowing 1 CPUs, 0 hotplug CPUs
[ 0.000000] PM: Registered nosave memory: 000000000009d000 - 000000000009e000
[ 0.000000] PM: Registered nosave memory: 000000000009e000 - 00000000000a0000
[ 0.000000] PM: Registered nosave memory: 00000000000a0000 - 00000000000f0000
[ 0.000000] PM: Registered nosave memory: 00000000000f0000 - 0000000000100000
[ 0.000000] Allocating PCI resources starting at 20000000 (gap: 20000000:dffc0000)
[ 0.000000] Booting paravirtualized kernel on bare hardware
[ 0.000000] setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:1 nr_node_ids:1
[ 0.000000] PERCPU: Embedded 27 pages/cpu #ffff88001fa00000 s79296 r8192 d23104 u2097152
[ 0.000000] Built 1 zonelists in Node order, mobility grouping on. Total pages: 129157
[ 0.000000] Policy zone: DMA32
[ 0.000000] Kernel command line: LABEL=cirros-rootfs ro console=tty0 console=ttyS0 console=hvc0
[ 0.000000] PID hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.000000] Checking aperture...
[ 0.000000] No AGP bridge found
[ 0.000000] Memory: 497852k/524276k available (6206k kernel code, 460k absent, 25964k reserved, 6907k data, 900k init)
[ 0.000000] SLUB: Genslabs=15, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU dyntick-idle grace-period acceleration is enabled.
[ 0.000000] NR_IRQS:4352 nr_irqs:256 16
[ 0.000000] Console: colour VGA+ 80x25
[ 0.000000] console [tty0] enabled
[ 0.000000] console [ttyS0] enabled
[ 0.000000] allocated 4194304 bytes of page_cgroup
[ 0.000000] please try 'cgroup_disable=memory' option if you don't want memory cgroups
[ 0.000000] Fast TSC calibration failed
[ 0.000000] TSC: Unable to calibrate against PIT
[ 0.000000] TSC: using PMTIMER reference calibration
[ 0.000000] Detected 2486.018 MHz processor.
[ 0.024490] Calibrating delay loop (skipped), value calculated using timer frequency.. 4972.03 BogoMIPS (lpj=9944072)
[ 0.025939] pid_max: default: 32768 minimum: 301
[ 0.029903] Security Framework initialized
[ 0.033041] AppArmor: AppArmor initialized
[ 0.033539] Yama: becoming mindful.
[ 0.037514] Dentry cache hash table entries: 65536 (order: 7, 524288 bytes)
[ 0.039560] Inode-cache hash table entries: 32768 (order: 6, 262144 bytes)
[ 0.040693] Mount-cache hash table entries: 256
[ 0.054301] Initializing cgroup subsys cpuacct
[ 0.054957] Initializing cgroup subsys memory
[ 0.056108] Initializing cgroup subsys devices
[ 0.056838] Initializing cgroup subsys freezer
[ 0.057341] Initializing cgroup subsys net_cls
[ 0.057824] Initializing cgroup subsys blkio
[ 0.058338] Initializing cgroup subsys perf_event
[ 0.060182] mce: CPU supports 10 MCE banks
[ 0.062116] SMP alternatives: switching to UP code
[ 0.236105] Freeing SMP alternatives: 24k freed
[ 0.237129] ACPI: Core revision 20110413
[ 0.270578] ftrace: allocating 26075 entries in 103 pages
[ 0.289821] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[ 0.332667] CPU0: AMD QEMU Virtual CPU version 1.0 stepping 03
[ 0.336020] APIC calibration not consistent with PM-Timer: 103ms instead of 100ms
[ 0.336020] APIC delta adjusted to PM-Timer: 6249961 (6456813)
[ 0.336020] Performance Events: Broken PMU hardware detected, using software events only.
[ 0.341160] Brought up 1 CPUs
[ 0.341596] Total of 1 processors activated (4972.03 BogoMIPS).
[ 0.348508] devtmpfs: initialized
[ 0.370265] print_constraints: dummy:
[ 0.370818] Time: 22:32:35 Date: 07/31/13
[ 0.373184] NET: Registered protocol family 16
[ 0.377862] ACPI: bus type pci registered
[ 0.379805] PCI: Using configuration type 1 for base access
[ 0.394436] bio: create slab <bio-0> at 0
[ 0.441293] ACPI: Interpreter enabled
[ 0.441749] ACPI: (supports S0 S3 S4 S5)
[ 0.442853] ACPI: Using IOAPIC for interrupt routing
[ 0.504949] ACPI: No dock devices found.
[ 0.505458] HEST: Table not found.
[ 0.505922] PCI: Ignoring host bridge windows from ACPI; if necessary, use "pci=use_crs" and report a bug
[ 0.508456] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[ 0.514427] pci 0000:00:01.3: quirk: [io 0xb000-0xb03f] claimed by PIIX4 ACPI
[ 0.515222] pci 0000:00:01.3: quirk: [io 0xb100-0xb10f] claimed by PIIX4 SMB
[ 0.526520] pci0000:00: Unable to request _OSC control (_OSC support mask: 0x1e)
[ 0.612644] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
[ 0.614063] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
[ 0.615312] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
[ 0.616918] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
[ 0.618197] ACPI: PCI Interrupt Link [LNKS] (IRQs 9) *0
[ 0.622888] vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none
[ 0.623734] vgaarb: loaded
[ 0.624235] vgaarb: bridge control possible 0000:00:02.0
[ 0.627513] SCSI subsystem initialized
[ 0.629754] usbcore: registered new interface driver usbfs
[ 0.630590] usbcore: registered new interface driver hub
[ 0.632126] usbcore: registered new device driver usb
[ 0.634610] PCI: Using ACPI for IRQ routing
[ 0.640771] NetLabel: Initializing
[ 0.641144] NetLabel: domain hash size = 128
[ 0.641570] NetLabel: protocols = UNLABELED CIPSOv4
[ 0.642769] NetLabel: unlabeled traffic allowed by default
[ 0.744929] AppArmor: AppArmor Filesystem Enabled
[ 0.746522] pnp: PnP ACPI init
[ 0.748377] ACPI: bus type pnp registered
[ 0.761838] pnp: PnP ACPI: found 8 devices
[ 0.762440] ACPI: ACPI bus type pnp unregistered
[ 0.791325] Switching to clocksource acpi_pm
[ 0.791325] NET: Registered protocol family 2
[ 0.792984] Switched to NOHz mode on CPU #0
[ 0.794980] IP route cache hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.800380] TCP established hash table entries: 16384 (order: 6, 262144 bytes)
[ 0.802008] TCP bind hash table entries: 16384 (order: 6, 262144 bytes)
[ 0.803089] TCP: Hash tables configured (established 16384 bind 16384)
[ 0.803751] TCP reno registered
[ 0.804373] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 0.805192] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 0.806852] NET: Registered protocol family 1
[ 0.807530] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[ 0.808586] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[ 0.809327] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[ 0.816560] audit: initializing netlink socket (disabled)
[ 0.817591] type=2000 audit(1375309954.816:1): initialized
[ 0.903327] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[ 0.928384] VFS: Disk quotas dquot_6.5.2
[ 0.929484] Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[ 0.938210] fuse init (API version 7.16)
[ 0.940982] msgmni has been set to 972
[ 0.949280] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[ 0.950562] io scheduler noop registered
[ 0.951008] io scheduler deadline registered (default)
[ 0.951941] io scheduler cfq registered
[ 0.955245] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[ 0.956970] pciehp: PCI Express Hot Plug Controller Driver version: 0.4
[ 0.960881] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
[ 0.962211] ACPI: Power Button [PWRF]
[ 0.979110] ERST: Table is not found!
[ 0.982891] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
[ 0.983651] virtio-pci 0000:00:03.0: PCI INT A -> Link[LNKC] -> GSI 11 (level, high) -> IRQ 11
[ 0.986746] ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 10
[ 0.987395] virtio-pci 0000:00:04.0: PCI INT A -> Link[LNKD] -> GSI 10 (level, high) -> IRQ 10
[ 0.993533] Trying to unpack rootfs image as initramfs...
[ 1.017633] ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 10
[ 1.018210] virtio-pci 0000:00:05.0: PCI INT A -> Link[LNKA] -> GSI 10 (level, high) -> IRQ 10
[ 1.020389] Serial: 8250/16550 driver, 32 ports, IRQ sharing enabled
[ 1.052583] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 1.082516] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
[ 1.165489] 00:05: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 1.244653] 00:06: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
[ 1.248018] hpet_acpi_add: no address or irqs in _CRS
[ 1.249922] Linux agpgart interface v0.103
[ 1.279474] brd: module loaded
[ 1.287981] loop: module loaded
[ 1.597690] vda: vda1
[ 1.624125] Freeing initrd memory: 2000k freed
[ 1.626790] scsi0 : ata_piix
[ 1.629007] scsi1 : ata_piix
[ 1.629910] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc0a0 irq 14
[ 1.630652] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc0a8 irq 15
[ 1.636489] Fixed MDIO Bus: probed
[ 1.637469] PPP generic driver version 2.4.2
[ 1.638209] tun: Universal TUN/TAP device driver, 1.6
[ 1.638756] tun: (C) 1999-2004 Max Krasnyansky <maxk#qualcomm.com>
openstack#openstack1:~$
You can get guest console on the dashboard or with this command:
nova get-vnc-console <instance id> novnc
If your guest image redirects console messages (like the ubuntu cloud image), you can see boot messages on dashboard or with the command:
nova console-log <instance id>
You may get clues in /var/log/nova/nova-compute.log and in your hypervisor logs (/var/log/libvirt/libvirtd.log for QEMU/KVM).
A possible cause is that your guest can't boot on its primary disk and get stuck on boot sequence. Try other images, like the ones proposed in OpenStack documentation.
Related
New problem moving from Ubuntu Impish to Jammy; Bluetooth LE Remote pairing/connecting, but not creating /dev/input
Something happened between Impish and Jammy on my device, and my Xiaomi MiTV bluetooth remote control no longer works. After upgrading to 22.04, it just stopped creating a /dev/input, and has continued not working even switching to mainline kernel 5.17 (Jammy's 5.15.x doesn't work either) and the wishful thinking that every update on apt that shows up will fix it. It's been there since the pre-release and has remained ever since. Device in question: https://xiaomi-mi.ca/accessories-tv-box/xiaomi-mi-tv-mi-tv-box-bluetooth-remote-control/ I'm running Ubuntu Mate on an Odroid H2+ (j4115-based x86 SBC) as a media player. Bluetooth has been supplied via a BCM20702A-based IOGear BT4.0 adapter (driver installed), but I've also tried a (legit) CSR8510-based BT4.0 adapter with similar results. It's a bit finicky, but pairs fine if certain steps are followed—but it's been that way with this remote and every ELEC I've had in the past that I've had in the past (PI ArmHF /Odroid ARM64). Note: It pairs and is usable on Windows, MacOS and iOS and pre-Jammy versions of Ubuntu. Addresses obfuscated to protect the innocent… REMOTE & CONTROLLER from bluetoothctl: [XiaoMi RC]# info Device F4:XX:XX:XX:XX:XX (public) Name: XiaoMi RC Alias: XiaoMi RC Appearance: 0x03c0 Paired: yes Trusted: yes Blocked: no Connected: yes WakeAllowed: yes LegacyPairing: no UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb) UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb) UUID: Immediate Alert (00001802-0000-1000-8000-00805f9b34fb) UUID: Link Loss (00001803-0000-1000-8000-00805f9b34fb) UUID: Tx Power (00001804-0000-1000-8000-00805f9b34fb) UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb) UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb) UUID: Human Interface Device (00001812-0000-1000-8000-00805f9b34fb) UUID: Scan Parameters (00001813-0000-1000-8000-00805f9b34fb) Modalias: bluetooth:v2717p3200d0110 Battery Percentage: 0x47 (71) [XiaoMi RC]# show 5C:XX:XX:XX:XX:XX Controller 5C:XX:XX:XX:XX:XX (public) Name: mybox Alias: mybox Class: 0x00000104 Powered: yes Discoverable: no DiscoverableTimeout: 0x000000b4 Pairable: yes UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb) UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb) UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb) UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb) UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb) UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb) Modalias: usb:v1D6Bp0246d0540 Discovering: no Roles: central Roles: peripheral Advertising Features: ActiveInstances: 0x00 (0) SupportedInstances: 0x05 (5) SupportedIncludes: tx-power SupportedIncludes: appearance SupportedIncludes: local-name LSUSB: Bus 001 Device 005: ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0 busctl: busctl introspect 'org.bluez' '/org/bluez/hci0/dev_F4_XX_XX_XX_XX_XX' NAME TYPE SIGNATURE RESULT/VALUE FLAGS org.bluez.Battery1 interface - - - .Percentage property y 71 emits-change org.bluez.Device1 interface - - - .CancelPairing method - - - .Connect method - - - .ConnectProfile method s - - .Disconnect method - - - .DisconnectProfile method s - - .Pair method - - - .Adapter property o "/org/bluez/hci0" emits-change .Address property s "F4:XX:XX:XX:XX:XX" emits-change .AddressType property s "public" emits-change .Alias property s "XiaoMi RC" emits-change writable .Appearance property q 960 emits-change .Blocked property b false emits-change writable .Class property u - emits-change .Connected property b true emits-change .Icon property s - emits-change .LegacyPairing property b false emits-change .ManufacturerData property a{qv} - emits-change .Modalias property s "bluetooth:v2717p3200d0110" emits-change .Name property s "XiaoMi RC" emits-change .Paired property b true emits-change .RSSI property n - emits-change .ServiceData property a{sv} - emits-change .ServicesResolved property b true emits-change .Trusted property b true emits-change writable .TxPower property n - emits-change .UUIDs property as 9 "00001800-0000-1000-8000-00805f9b34fb… emits-change .WakeAllowed property b true emits-change writable org.freedesktop.DBus.Introspectable interface - - - .Introspect method - s - org.freedesktop.DBus.Properties interface - - - .Get method ss v - .GetAll method s a{sv} - .Set method ssv - - .PropertiesChanged signal sa{sv}as - a few odd messages in syslog, but nothing that screams "major fail": :~$ cat /var/log/syslog | grep "Blue" Apr 5 22:50:24 mybox systemd[1]: Starting Bluetooth management mechanism... Apr 5 22:50:24 mybox kernel: [ 7.337177] Bluetooth: Core ver 2.22 Apr 5 22:50:24 mybox kernel: [ 7.337217] Bluetooth: HCI device and connection manager initialized Apr 5 22:50:24 mybox kernel: [ 7.337222] Bluetooth: HCI socket layer initialized Apr 5 22:50:24 mybox kernel: [ 7.337227] Bluetooth: L2CAP socket layer initialized Apr 5 22:50:24 mybox kernel: [ 7.337234] Bluetooth: SCO socket layer initialized Apr 5 22:50:24 mybox kernel: [ 7.575381] Bluetooth: hci0: BCM: chip id 63 Apr 5 22:50:24 mybox kernel: [ 7.576384] Bluetooth: hci0: BCM: features 0x07 Apr 5 22:50:24 mybox kernel: [ 7.592401] Bluetooth: hci0: BCM20702A Apr 5 22:50:24 mybox kernel: [ 7.592411] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000 Apr 5 22:50:24 mybox kernel: [ 7.594649] Bluetooth: hci0: BCM20702A1 'brcm/BCM20702A1-0a5c-21e8.hcd' Patch Apr 5 22:50:24 mybox kernel: [ 8.196379] Bluetooth: hci0: unexpected event 0xff length: 2 > 0 Apr 5 22:50:24 mybox systemd[1]: Started Bluetooth management mechanism. Apr 5 22:50:24 mybox kernel: [ 8.518390] Bluetooth: hci0: Broadcom Bluetooth Device Apr 5 22:50:24 mybox kernel: [ 8.518400] Bluetooth: hci0: BCM20702A1 (001.002.014) build 1764 Apr 5 22:50:24 mybox systemd[1]: Starting Bluetooth service... Apr 5 22:50:24 mybox bluetoothd[970]: Bluetooth daemon 5.64 Apr 5 22:50:24 mybox systemd[1]: Started Bluetooth service. Apr 5 22:50:24 mybox NetworkManager[699]: <info> [1649213424.6320] Loaded device plugin: NMBluezManager (/usr/lib/x86_64-linux-gnu/NetworkManager/1.36.4/libnm-device-plugin-bluetooth.so) Apr 5 22:50:24 mybox systemd[1]: Reached target Bluetooth Support. Apr 5 22:50:24 mybox kernel: [ 8.948829] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 Apr 5 22:50:24 mybox kernel: [ 8.948837] Bluetooth: BNEP filters: protocol multicast Apr 5 22:50:24 mybox kernel: [ 8.948843] Bluetooth: BNEP socket layer initialized Apr 5 22:50:24 mybox bluetoothd[970]: Bluetooth management interface 1.21 initialized Apr 5 22:50:36 mybox kernel: [ 20.341197] Bluetooth: RFCOMM TTY layer initialized Apr 5 22:50:36 mybox kernel: [ 20.341222] Bluetooth: RFCOMM socket layer initialized Apr 5 22:50:36 mybox kernel: [ 20.341233] Bluetooth: RFCOMM ver 1.11 Apr 5 22:56:28 mybox systemd[1777]: Reached target Bluetooth. Apr 5 23:17:03 mybox systemd[1777]: Starting Bluetooth Manager... Apr 5 23:17:03 mybox systemd[1777]: Started Bluetooth Manager. Apr 5 23:17:25 mybox kernel: [ 1630.329450] Bluetooth: hci0: unexpected SMP command 0x0b from f4:xx:xx:xx:xx:xx Apr 5 23:17:52 mybox blueman-manager[115657]: blueman.bluez.errors.BluezDBusException: org.freedesktop.DBus.Error.InvalidArgs No such interface 'org.bluez.Battery1' Apr 6 06:21:33 mybox NetworkManager[660748]: <info> [1649240493.3391] Loaded device plugin: NMBluezManager (/usr/lib/x86_64-linux-gnu/NetworkManager/1.36.4/libnm-device-plugin-bluetooth.so) The remote pairs and connects. I can obviously see it bluetoothctl. But no event is created in /dev/input: me#mybox:~$ sudo evtest No device specified, trying to scan all of /dev/input/event* Available devices: /dev/input/event0: Power Button /dev/input/event1: Power Button /dev/input/event2: Video Bus /dev/input/event3: Logitech K400 Plus /dev/input/event4: Microsoft X-Box 360 pad /dev/input/event5: Microsoft X-Box 360 pad /dev/input/event6: Microsoft X-Box 360 pad /dev/input/event7: Pulse-Eight CEC Adapter /dev/input/event8: Microsoft X-Box 360 pad /dev/input/event9: HDA Intel PCH Mic /dev/input/event10: HDA Intel PCH Headphone /dev/input/event11: HDA Intel PCH HDMI/DP,pcm=3 /dev/input/event12: HDA Intel PCH HDMI/DP,pcm=7 /dev/input/event13: HDA Intel PCH HDMI/DP,pcm=8 /dev/input/event14: HDA Intel PCH HDMI/DP,pcm=9 /dev/input/event15: HDA Intel PCH HDMI/DP,pcm=10 Select the device event number [0-15]: showkey and xev gets no keypresses, but btmon is seeing them: me#mybox:~$ sudo btmon Bluetooth monitor ver 5.64 = Note: Linux version 5.17.1-051701-generic (x86_64) 0.026997 = Note: Bluetooth subsystem version 2.22 0.027002 = New Index: 5C:XX:XX:XX:XX:XX (Primary,USB,hci0) [hci0] 0.027004 = Open Index: 5C:XX:XX:XX:XX:XX [hci0] 0.027004 = Index Info: 5C:XX:XX:XX:XX:XX (Broadcom Corporation) [hci0] 0.027005 # MGMT Open: bluetoothd (privileged) version 1.21 {0x0001} 0.027006 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #1 [hci0] 1.698718 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000510000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #2 [hci0] 1.774350 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000000000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #3 [hci0] 2.594360 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000520000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #4 [hci0] 2.754407 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000000000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #5 [hci0] 3.414342 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000500000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #6 [hci0] 3.574341 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000000000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #7 [hci0] 4.014365 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 00004f0000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #8 [hci0] 4.174358 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000000000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #9 [hci0] 4.674365 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000660000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #10 [hci0] 4.934380 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000000000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #11 [hci0] 5.794429 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000800000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #12 [hci0] 6.034380 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000000000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #13 [hci0] 7.194396 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000810000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #14 [hci0] 7.354432 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000000000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #15 [hci0] 8.454406 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 00004a0000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #16 [hci0] 8.694405 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000000000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #17 [hci0] 10.414431 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000650000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #18 [hci0] 10.654417 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000000000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #19 [hci0] 11.134410 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000f10000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #20 [hci0] 11.294427 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000000000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #21 [hci0] 12.094482 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000280000000000 > ACL Data RX: Handle 64 flags 0x02 dlen 15 #22 [hci0] 12.234598 ATT: Handle Value Notification (0x1b) len 10 Handle: 0x0032 Data: 0000000000000000 This is driving me nuts. Especially because another similar model of the same remote that uses AAA batteries instead of a coin-cell battery works (that one disconnects regularly, and is slow to reconnect however, but pairs fine, creates an input event and all keypresses are recognized).
Custom HID Gamepad works on Windows, has some inverted buttons in Linux
I've designed a custom gamepad using an STM32. It has four analog axes, and 22 buttons. I have written firmware for it, including the USB Descriptor (that took a few tries). It works exactly as expected on Windows, but on Linux (Raspbian specifically) the last 5 buttons are inverted ("on" by default, "off" when pressed) It is critical to my product that it work on both platforms (Mac too, but I don't have one to test right now) Any ideas why this would be, and what to do about it? Here's the output of lsusb -v for this device: Bus 001 Device 003: ID 0483:5750 STMicroelectronics Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0483 STMicroelectronics idProduct 0x5750 bcdDevice 2.00 iManufacturer 1 STMicroelectronics iProduct 2 STM32 Custom Human interface iSerial 3 74E79C303734 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 0x0029 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 bInterfaceProtocol 0 iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.11 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 53 Report Descriptor: (length is 53) Item(Global): Usage Page, data= [ 0x01 ] 1 Generic Desktop Controls Item(Local ): Usage, data= [ 0x05 ] 5 Gamepad Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Local ): Usage, data= [ 0x01 ] 1 Pointer Item(Main ): Collection, data= [ 0x00 ] 0 Physical Item(Local ): Usage, data= [ 0x30 ] 48 Direction-X Item(Local ): Usage, data= [ 0x31 ] 49 Direction-Y Item(Local ): Usage, data= [ 0x32 ] 50 Direction-Z Item(Local ): Usage, data= [ 0x33 ] 51 Rotate-X Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0xff 0x0f ] 4095 Item(Global): Report Size, data= [ 0x10 ] 16 Item(Global): Report Count, data= [ 0x04 ] 4 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Main ): End Collection, data=none Item(Global): Usage Page, data= [ 0x09 ] 9 Buttons Item(Local ): Usage Minimum, data= [ 0x01 ] 1 Button 1 (Primary) Item(Local ): Usage Maximum, data= [ 0x16 ] 22 (null) Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0x01 ] 1 Item(Global): Report Size, data= [ 0x01 ] 1 Item(Global): Report Count, data= [ 0x16 ] 22 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Report Size, data= [ 0x01 ] 1 Item(Global): Report Count, data= [ 0x02 ] 2 Item(Main ): Input, data= [ 0x03 ] 3 Constant Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Main ): End Collection, data=none Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0002 1x 2 bytes bInterval 10 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0002 1x 2 bytes bInterval 10 Device Status: 0x0001 Self Powered I also just noticed that the stick positions are different (again, correct on Windows, and wrong on Linux.) I did read something about Linux having a kernel driver that does something to these values? jstest-gtk lets me control some aspects of the axes (scaling, dead zones, inversion) maybe that's a clue?
QEMU how-to allocate specific IRQ number for PCI device?
I'm running qemu-system-x86_64 with my new pci device. And i want to use IRQ 17 (Since driver from kernel listen for IRQ 17). But my PCI device take IRQ 10 or 11. base on interrupt_pin(A,B,C,E). Then i want to send irq to kernel module by qemu_irq_pulse. This is how i allocate irq: pci_config_set_interrupt_pin(pci_dev->config, 1); d->irq = pci_allocate_irq(pci_dev) root#hostname:~# cat /proc/interrupts CPU0 0: 48 IO-APIC 2-edge timer 1: 9 IO-APIC 1-edge i8042 4: 1440 IO-APIC 4-edge ttyS0 8: 1 IO-APIC 8-edge rtc0 9: 0 IO-APIC 9-fasteoi acpi 12: 125 IO-APIC 12-edge i8042 24: 773 PCI-MSI 512000-edge ahci[0000:00:1f.2] 25: 355 PCI-MSI 32768-edge eth0-rx-0 26: 160 PCI-MSI 32769-edge eth0-tx-0 27: 1 PCI-MSI 32770-edge eth0 lspci -nk -vv: 00:1f.3 0880: 10de:0101 (rev 01) Subsystem: 1af4:1100 Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Interrupt: pin A routed to IRQ 10 Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit+ Address: 0000000000000000 Data: 0000 Kernel driver failed to request irq since it trying to attach to IRQ 17. I don't want to change kernel side. This is what i want to see: root#hostname:~# cat /proc/interrupts CPU0 0: 2213 IO-APIC 17: 0 IO-APIC 17-fasteoi some_kernel_driver_name How to allocate interrupt 17 for PCI device in qemu?
Im not sure it is correct answer but for me it helps: Add to ACPI: irqs = 17; aml_append(crs, aml_interrupt(AML_CONSUMER, AML_EDGE, AML_ACTIVE_HIGH, AML_SHARED, &irqs, 1)); Also PCI interrupt number looks like somehow depends on PCI vendor_id and device_id.
How to understand the disassemble code output from gdb
Look at the following output from gdb, why does the instruction code is disordered? It shows: 0xffffffff81107714 <+7>: mov %rdi,%rbx then shows 0xffffffff8110770f <+2>: cmpq $0x0,0x10(%rdi) . (gdb) disassemble /m __d_rehash Dump of assembler code for function __d_rehash: 1997 { 0xffffffff8110770d <+0>: push %rbp 0xffffffff8110770e <+1>: push %rbx 0xffffffff81107714 <+7>: mov %rdi,%rbx 1998 BUG_ON(!d_unhashed(entry)); 0xffffffff8110770f <+2>: cmpq $0x0,0x10(%rdi) 0xffffffff81107717 <+10>: je 0xffffffff8110771b <__d_rehash+14> 0xffffffff81107719 <+12>: ud2 1999 hlist_bl_lock(b); 2000 entry->d_flags |= DCACHE_RCUACCESS; 0xffffffff81107726 <+25>: orl $0x80,(%rbx) 2001 hlist_bl_add_head_rcu(&entry->d_hash, b); 0xffffffff8110772c <+31>: lea 0x8(%rbx),%rdx 2002 hlist_bl_unlock(b); 2003 } 0xffffffff81107756 <+73>: pop %rbx 0xffffffff81107757 <+74>: pop %rbp 0xffffffff81107758 <+75>: retq The following output by kernel oops shows that __d_rehash+0x19/0x4c is the parent call of crash. But I can't find the exact source responding to __d_rehash+0x19 from above disassemble output. [ 2630.421613] RIP: 0010:[<ffffffff8110739c>] [<ffffffff8110739c>] bit_spin_lock.constprop.17+0xb/0x1f [ 2630.421618] RSP: 0018:ffff8800b4a83c00 EFLAGS: 00000202 [ 2630.421619] RAX: 0000000000000001 RBX: 0000000000000000 RCX: 0000000000000013 [ 2630.421620] RDX: ffffc90000000000 RSI: ffffc900003b6130 RDI: ffffc900003b6130 [ 2630.421621] RBP: ffffc900003b6130 R08: ffff8800b4a83c70 R09: ffff8800bc286880 [ 2630.421622] R10: 0000000000000000 R11: ffff8800bc283940 R12: ffff8800bc283940 [ 2630.421623] R13: ffffc900003b6130 R14: 0000000000000000 R15: 0000000000000000 [ 2630.421625] FS: 00007fd5c5c2f7a0(0000) GS:ffff8800bfd80000(0000) knlGS:0000000000000000 [ 2630.421626] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2630.421627] CR2: 000000000042ba30 CR3: 00000000ad201000 CR4: 00000000000406e0 [ 2630.421631] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2630.421632] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 2630.421633] Process dpkg (pid: 9941, threadinfo ffff8800b4a82000, task ffff880030871000) [ 2630.421634] Stack: [ 2630.421635] ffff88002f20b600 ffffffff81107726 ffff88002f20b600 ffff88002f20b600 [ 2630.421637] ffffffff8110848b 0000000000000000 ffffffff81108fef 000000000000000c [ 2630.421639] ffff8800bc283940 ffff88002f20b600 ffff8800b4a83d68 ffff8800bc11bb40 [ 2630.421641] Call Trace: [ 2630.421644] [<ffffffff81107726>] ? __d_rehash+0x19/0x4c [ 2630.421646] [<ffffffff8110848b>] ? d_rehash+0x24/0x2a [ 2630.421648] [<ffffffff81108fef>] ? d_splice_alias+0xb2/0xbd [ 2630.421655] [<ffffffffa016a121>] ? ext4_lookup+0xc5/0xd2 [ext4] [ 2630.421658] [<ffffffff8110013a>] ? d_alloc_and_lookup+0x33/0x62 [ 2630.421661] [<ffffffff81100996>] ? walk_component+0x1e7/0x3a0 [ 2630.421663] [<ffffffff81101a29>] ? path_lookupat+0x8b/0x2ac [ 2630.421666] [<ffffffff8103a683>] ? should_resched+0x5/0x23 [ 2630.421669] [<ffffffff813453b9>] ? _cond_resched+0x7/0x1c [ 2630.421671] [<ffffffff81101c66>] ? do_path_lookup+0x1c/0x81 [ 2630.421673] [<ffffffff8110346a>] ? user_path_at_empty+0x48/0x7d [ 2630.421675] [<ffffffff810fb89e>] ? cp_new_stat+0xf0/0x104 [ 2630.421677] [<ffffffff810fb675>] ? vfs_fstatat+0x2d/0x63 [ 2630.421678] [<ffffffff810fb949>] ? sys_newstat+0x12/0x2d [ 2630.421681] [<ffffffff8134b792>] ? system_call_fastpath+0x16/0x1b
__d_rehash+0x19 is hex, 25 decimal, which corresponds to 2000 entry->d_flags |= DCACHE_RCUACCESS; 0xffffffff81107726 <+25>: orl $0x80,(%rbx) This is not "parent call" but return address, presumably from a call "hidden" in 1999 hlist_bl_lock(b); The code is "reordered" because the compiler is free to generate it however it sees fit as long as the resulting semantics are the same and it figured it is beneficial to shuffle things up. Then as you can see gdb figured it will show it in a displaced manner. A significantly better linux kernel debugger is "crash". It will happen to show all the assembly in order and annotate all blocks with file:line marks if you do 'dis -l'.
Reverse-engineering a HID handshake by examining bytes over USB
I'm trying to extract real-time data from a Wacom Inkling Roel Janssen has already examined the packets here: // Some kind of handshaking. // Values obtained by sniffing the USB connection between SketchManager and the device. unsigned char usb_data[33]; memset (&usb_data, '\0', 33); int bytes = 0; memcpy (&usb_data, "\x80\x01\x03\x01\x02\x00\x00\x00", 8); bytes += libusb_control_transfer (handle, 0x21, // bmRequestType 9, // bRequest 0x0380, // wValue 0, // wIndex usb_data, // data 33, // wLength 0); // timeout memcpy (&usb_data, "\x80\x01\x0a\x01\x01\x0b\x01\x00", 8); bytes += libusb_control_transfer (handle, 0x21, 9, 0x0380, 0, usb_data, 33, 0); memset (&usb_data, '\0', 33); bytes += libusb_control_transfer (handle, 0xa1, 1, 0x0380, 0, usb_data, 33, 0); memcpy (&usb_data, "\x80\x01\x0b\x01\x00\x00\x00\x00", 8); bytes += libusb_control_transfer (handle, 0x21, 9, 0x0380, 0, usb_data, 33, 0); memcpy (&usb_data, "\x80\x01\x02\x01\x01\x00\x00\x00", 8); bytes += libusb_control_transfer (handle, 0x21, 9, 0x0380, 0, usb_data, 33, 0); memcpy (&usb_data, "\x80\x01\x0a\x01\x01\x02\x01\x00", 8); bytes += libusb_control_transfer (handle, 0x21, 9, 0x0380, 0, usb_data, 33, 0); memset (&usb_data, '\0', 33); bytes += libusb_control_transfer (handle, 0xa1, 1, 0x0380, 0, usb_data, 33, 0); I'm trying to rewrite this code using HID API which has a very minimal API (here) I'm going to attempt to just use hid_write for now, but there is maybe a chance this handshake is sending a feature report...? Is there anyone out there who can look at that bytestream and see what is going on? EDIT: It appears the Inkling exposes a FlashDrive and HID interface, so I am guessing this bytecode must be selecting the HID interface and telling it to start sending data. But can I code it in a more elegant / human readable form? EDIT: I have it working! Both hid_write and hid_send_feature_report work! hid_device* handle = hid_open(inklingVendorId, inklingProductId, NULL); jassert(handle != nullptr); int bytes_written = hid_send_feature_report(handle, (const unsigned char *)"\x80\x01\x03\x01\x02\x00\x00\x00", 8) + hid_send_feature_report(handle, (const unsigned char *)"\x80\x01\x0a\x01\x01\x0b\x01\x00", 8) + hid_send_feature_report(handle, (const unsigned char *)"\x80\x01\x0b\x01\x00\x00\x00\x00", 8) + hid_send_feature_report(handle, (const unsigned char *)"\x80\x01\x02\x01\x01\x00\x00\x00", 8) + hid_send_feature_report(handle, (const unsigned char *)"\x80\x01\x0a\x01\x01\x02\x01\x00", 8); jassert(bytes_written == 5*8); const int enable_nonblocking = 1, disable_nonblocking = 0; jassert( hid_set_nonblocking(handle, disable_nonblocking) != FAIL); // want to block while(true) { int bytes_got = hid_read(handle, usb_data, 10); ... However I would still like to understand what is going on. This is rather hacky. EDIT: Output of lsusb (from Roel, I don't have Linux to hand): Bus 003 Device 002: ID 056a:0221 Wacom Co., Ltd Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x056a Wacom Co., Ltd idProduct 0x0221 bcdDevice 12.56 iManufacturer 1 (error) iProduct 2 MSC Device iSerial 5 4833000045C5549C0002DD012DA5549C bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 57 bNumInterfaces 2 bConfigurationValue 1 iConfiguration 3 USB/MSC Inkling bmAttributes 0x80 (Bus Powered) MaxPower 500mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 No Subclass bInterfaceProtocol 2 Mouse iInterface 0 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.01 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 215 Report Descriptor: (length is 215) Item(Global): Usage Page, data= [ 0x0d ] 13 Digitizer Item(Local ): Usage, data= [ 0x02 ] 2 Pen Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Global): Report ID, data= [ 0x02 ] 2 Item(Local ): Usage, data= [ 0x02 ] 2 Pen Item(Main ): Collection, data= [ 0x00 ] 0 Physical Item(Global): Usage Page, data= [ 0x01 ] 1 Generic Desktop Controls Item(Local ): Usage, data= [ 0x30 ] 48 Direction-X Item(Local ): Usage, data= [ 0x31 ] 49 Direction-Y Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0x80 0x07 ] 1920 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0x00 0x78 ] 30720 Item(Global): Unit, data= [ 0x11 ] 17 System: SI Linear, Unit: Centimeter Item(Global): Unit Exponent, data= [ 0x0e ] 14 Unit Exponent: 14 Item(Global): Report Size, data= [ 0x10 ] 16 Item(Global): Report Count, data= [ 0x02 ] 2 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Usage Page, data= [ 0x0d ] 13 Digitizer Item(Local ): Usage, data= [ 0x42 ] 66 Tip Switch Item(Local ): Usage, data= [ 0x45 ] 69 Eraser Item(Local ): Usage, data= [ 0x44 ] 68 Barrel Switch Item(Local ): Usage, data= [ 0x32 ] 50 In Range Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0x01 ] 1 Item(Global): Report Size, data= [ 0x01 ] 1 Item(Global): Report Count, data= [ 0x04 ] 4 Item(Global): Unit, data= [ 0x00 ] 0 System: None, Unit: (None) Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Usage Page, data= [ 0x09 ] 9 Buttons Item(Local ): Usage Minimum, data= [ 0x01 ] 1 Button 1 (Primary) Item(Local ): Usage Maximum, data= [ 0x04 ] 4 Button 4 Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0x01 ] 1 Item(Global): Report Size, data= [ 0x01 ] 1 Item(Global): Report Count, data= [ 0x04 ] 4 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Usage Page, data= [ 0x0d ] 13 Digitizer Item(Local ): Usage, data= [ 0x30 ] 48 Tip Pressure Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0x00 0x04 ] 1024 Item(Global): Report Size, data= [ 0x10 ] 16 Item(Global): Report Count, data= [ 0x01 ] 1 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Usage Page, data= [ 0x0d ] 13 Digitizer Item(Local ): Usage, data= [ 0x3d ] 61 X Tilt Item(Local ): Usage, data= [ 0x3e ] 62 Y Tilt Item(Global): Logical Minimum, data= [ 0x81 ] 129 Item(Global): Logical Maximum, data= [ 0x7f ] 127 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x02 ] 2 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Main ): End Collection, data=none Item(Global): Usage Page, data= [ 0x01 ] 1 Generic Desktop Controls Item(Local ): Usage, data= [ 0x00 ] 0 Undefined Item(Global): Report ID, data= [ 0x04 ] 4 Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x0c ] 12 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Usage Page, data= [ 0x01 ] 1 Generic Desktop Controls Item(Local ): Usage, data= [ 0x00 ] 0 Undefined Item(Global): Report ID, data= [ 0x08 ] 8 Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x3b ] 59 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Local ): Usage, data= [ 0x01 ] 1 Pointer Item(Global): Report ID, data= [ 0x80 ] 128 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x20 ] 32 Item(Main ): Feature, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Main ): End Collection, data=none Item(Global): Usage Page, data= [ 0x01 ] 1 Generic Desktop Controls Item(Local ): Usage, data= [ 0x02 ] 2 Mouse Item(Main ): Collection, data= [ 0x01 ] 1 Application Item(Global): Report ID, data= [ 0x01 ] 1 Item(Local ): Usage, data= [ 0x01 ] 1 Pointer Item(Main ): Collection, data= [ 0x00 ] 0 Physical Item(Global): Usage Page, data= [ 0x01 ] 1 Generic Desktop Controls Item(Local ): Usage, data= [ 0x30 ] 48 Direction-X Item(Local ): Usage, data= [ 0x31 ] 49 Direction-Y Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0x80 0x07 ] 1920 Item(Global): Physical Minimum, data= [ 0x00 ] 0 Item(Global): Physical Maximum, data= [ 0x00 0x78 ] 30720 Item(Global): Unit, data= [ 0x11 ] 17 System: SI Linear, Unit: Centimeter Item(Global): Unit Exponent, data= [ 0x0e ] 14 Unit Exponent: 14 Item(Global): Report Size, data= [ 0x10 ] 16 Item(Global): Report Count, data= [ 0x02 ] 2 Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Usage Page, data= [ 0x09 ] 9 Buttons Item(Local ): Usage Minimum, data= [ 0x01 ] 1 Button 1 (Primary) Item(Local ): Usage Maximum, data= [ 0x03 ] 3 Button 3 (Tertiary) Item(Global): Logical Minimum, data= [ 0x00 ] 0 Item(Global): Logical Maximum, data= [ 0x01 ] 1 Item(Global): Report Size, data= [ 0x01 ] 1 Item(Global): Report Count, data= [ 0x03 ] 3 Item(Global): Unit, data= [ 0x00 ] 0 System: None, Unit: (None) Item(Main ): Input, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Global): Report Count, data= [ 0x05 ] 5 Item(Main ): Input, data= [ 0x01 ] 1 Constant Array Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield Item(Main ): End Collection, data=none Item(Main ): End Collection, data=none Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 4 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk-Only iInterface 4 USB/MSC Inkling Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 bNumConfigurations 2 Device Status: 0x0000 (Bus Powered)
1) Verify that the Inkling uses HID USB device class. Try lsusb -v and check the bDeviceClass or bInterfaceClass field in the output (The USB human interface device class can be used to describe both device and interface classes. The interface class is used when a USB device can contain more than one function. from https://en.wikipedia.org/wiki/USB_human_interface_device_class) In the manual (https://www.wacom.com/~/media/files/store-manuals/inkling-manual-english.pdf) is said that it is a USB flash drive, in this case it uses USB mass storage device class (BULK transfer) 2) If it is a USB HID device class you can try to get the feature reports (if the inkling sends any) similar to this website http://libusb.6.n5.nabble.com/How-to-get-HID-report-td4628.html libusb_get_descriptor makes standard GET_DESCRIPTOR requests, where the bmRequestType field is 0x80. The DT_REPORT descriptor request must indicate that the recipient is an interface, which requires bmRequestType to be 0x81. You have two good choices. The report descriptors are all included in the configuration descriptor, so you should be able to fetch the whole configuration descriptor en masse and parse it to extract the report descriptors. Alternatively, libusb_get_descriptor is a very thin layer over libusb_control_transfer , so you could just expand it by hand: res = libusb_control_transfer( devh, LIBUSB_ENDPOINT_IN | LIBUSB_RECIPIENT_INTERFACE, LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_REPORT << 8) | 0, 0, buf, sizeof(buf), 1000); more links: - http://eleccelerator.com/tutorial-about-usb-hid-report-descriptors/ http://www.beyondlogic.org/usbnutshell/usb1.shtml --------------------------------------------------------------------------------- libusb_control_transfer performs USB control transfers. Control transfers are used for command and status operations, see this http://libusb.sourceforge.net/api-1.0/group__syncio.html and this http://www.beyondlogic.org/usbnutshell/usb4.shtml#Control USB control requests are a subtype of USB requests, see http://www.beyondlogic.org/usbnutshell/usb6.shtml usb_data seems to be the USB send buffer, it is always filled with the data bytes, then the libusb_control_transfer is send This is the commented form of the USB control request (http://www.beyondlogic.org/usbnutshell/usb6.shtml) memcpy (&usb_data, "\x80\x01\x03\x01\x02\x00\x00\x00", 8); bytes += libusb_control_transfer (handle, 0x21, // bmRequestType 9, // bRequest 0x0380, // wValue 0, // wIndex usb_data, // data 33, // wLength 0); // timeout This is the short form of the USB control request memcpy (&usb_data, "\x80\x01\x0a\x01\x01\x0b\x01\x00", 8); bytes += libusb_control_transfer (handle, 0x21, 9, 0x0380, 0, usb_data, 33, 0); So all the byte sequences like "\x80\x01\x03\x01\x02\x00\x00\x00" are commands codes that are used to configure the Inkling ('handshake') and only the Inkling and the Wacom folks understand...
So this is one single report you send over USB: 80 01 03 01 02 00 00 00 .... (in total the buffer is 1+32 = 33 bytes) ^^ Report ID This is the relevant part from the HID descriptor: ... Item(Global): Report ID, data= [ 0x80 ] 128 Item(Global): Report Size, data= [ 0x08 ] 8 Item(Global): Report Count, data= [ 0x20 ] 32 Item(Main ): Feature, data= [ 0x02 ] 2 Data Variable Absolute No_Wrap Linear Preferred_State No_Null_Position Non_Volatile Bitfield This says that your data for Report ID 0x80 has to be interpreted as 32 times one byte (it's meaning is up to the driver I guess). It is a Feature which means that it can configure the device via GET_FEATURE/SET_FEATURE reports over the control endpoint. For more information about how to interpret this descriptor, see the HID v1.1 specification from http://www.usb.org/developers/hidpage/.