Skip to content

penx/bmRequestType

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bmRequestType

Calculate bmRequestType for USB

i.e.

Useful combined with e.g. node-usb.

Usage

npm i bmrequesttype
const { bmRequestType, DIRECTION, TYPE, RECIPIENT } = require('bmrequesttype');
bmRequestType(DIRECTION.Out, TYPE.Class, RECIPIENT.Interface); // 33

API

bmRequestType(direction, type, recipient)

DIRECTION.Out = 0
DIRECTION.In = 1

TYPE.Standard = 0
TYPE.Class = 1
TYPE.Vendor = 2
TYPE.Reserved = 3

RECIPIENT.Device = 0
RECIPIENT.Interface = 1
RECIPIENT.Endpoint = 2
RECIPIENT.Other = 3