Пример #1
0
    def test_format_usb_req(self):
        request = UsbRequest(set_addr_req)
        expected = \
"""bmRequestType: 00 0b0
bRequest: 05 (SET_ADDRESS)
wValue: 6400
wIndex: 0000
wLength: 0000
data: 
"""
        self.assertEquals(expected, request.format())
Пример #2
0
 def test_set_addr_req(self):
     request = UsbRequest(set_addr_req)
     self.assertEquals(0x00, request.bmRequestType)
     self.assertEquals(0x05, request.bRequest)
     self.assertEquals(0x00, request.wLength)
     self.assertEquals(True, request.canIgnore())
Пример #3
0
 def test_get_device_desc_req(self):
     dev_desc_req = [0x80, 0x06, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00]
     request = UsbRequest(dev_desc_req)
     self.assertEquals(0x01, request.wValue)
     self.assertTrue(request.isDeviceDescriptorRequest())
     self.assertTrue(request.canIgnore())
Пример #4
0
 def test_get_descriptor_req(self):
     request = UsbRequest(u[1:])
     self.assertEquals(0x80, request.bmRequestType)
     self.assertEquals(0x06, request.bRequest)
     self.assertEquals(True, request.canIgnore())