{"record":{"id":"c5839a490c9134e5","repo":"bettercap/bettercap","slug":"hid-frame-injection-requires-the-device-type-to-be","errorCode":null,"errorMessage":"HID frame injection requires the device type to be detected, try to 'hid.sniff %s' for a few seconds.","messagePattern":"HID frame injection requires the device type to be detected, try to 'hid\\.sniff (.+?)' for a few seconds\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/hid/hid_inject.go","lineNumber":34,"sourceCode":"}\n\nfunc (mod *HIDRecon) setInjectionMode(address string) error {\n\tif err := mod.setSniffMode(address, true); err != nil {\n\t\treturn err\n\t} else if address == \"clear\" {\n\t\tmod.inInjectMode = false\n\t} else {\n\t\tmod.inInjectMode = true\n\t}\n\treturn nil\n}\n\nfunc errNoDevice(addr string) error {\n\treturn fmt.Errorf(\"HID device %s not found, make sure that hid.recon is on and that this device has been discovered\", addr)\n}\n\nfunc errNoType(addr string) error {\n\treturn fmt.Errorf(\"HID frame injection requires the device type to be detected, try to 'hid.sniff %s' for a few seconds.\", addr)\n}\n\nfunc errNotSupported(dev *network.HIDDevice) error {\n\treturn fmt.Errorf(\"HID frame injection is not supported for device type %s\", dev.Type.String())\n}\n\nfunc errNoKeyMap(layout string) error {\n\treturn fmt.Errorf(\"could not find keymap for '%s' layout, supported layouts are: %s\", layout, SupportedLayouts())\n}\n\nfunc (mod *HIDRecon) prepInjection() (error, *network.HIDDevice, []*Command) {\n\tvar err error\n\n\tif err, mod.sniffType = mod.StringParam(\"hid.force.type\"); err != nil {\n\t\treturn err, nil, nil\n\t}\n\n\tdev, found := mod.Session.HID.Get(mod.sniffAddr)","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/bettercap/bettercap/blob/8eca2820f3c41d2004434ed5a291d87462caeeb7/modules/hid/hid_inject.go#L16-L52","documentation":"Sentinel error returned by errNoType when frame injection is attempted on a discovered HID device whose type (e.g. Logitech vs Microsoft/Broadcom) has not yet been fingerprinted. The device is known, but its Type field is still unset because no sniffing session has captured identifying traffic.","triggerScenarios":"Thrown at modules/hid/hid_inject.go:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run 'hid.sniff <address>' for a few seconds so the device type can be detected","Retry the injection command after the type is shown in the HID view"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8eca2820f3c41d2004434ed5a291d87462caeeb7","analyzedAt":"2026-09-02T12:49:00.712Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}