<commit_before><commit_msg>reading stream data from correct device<commit_after>import usb.core
import usb.util

def main():
    device = usb.core.find(idVendor=0x1a86, idProduct=0x7523)
    device.reset()

    print device

    if device.is_kernel_driver_active(0):
        reattach = True
        device.detach_kernel_driver(0)
 
    print "Start"
    # use the first/default configuration
    device.set_configuration()

    # first endpoint
    endpoint = device[0][(0,0)][0]

    print endpoint
    # read a data packet
    data = None
    while True:
    #for x in range(0, 10):
        #print "ASDF %d" % x
        try:
            #print "Trying hard..."
            data = device.read(endpoint.bEndpointAddress, 0x4)
                                  # endpoint.wMaxPacketSize)
            print data
            #print "At %d getting %r" % (x, data)

            #RxData = ''.join([chr(x) for x in data])
            #print RxData

        except usb.core.USBError as e:
            print "And failing"
            print e
            data = None
            if e.args == ('Operation timed out',):

                continue

    usb.util.dispose_resources(device)

if __name__ == '__main__':
  main()
{'fraction_non_alphanumeric': 0.1024793388429752, 'fraction_numerical': 0.01652892561983471, 'mean_word_length': 1.8902147971360381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5797338', 'n_tokens_mistral': 379, 'n_tokens_neox': 358, 'n_words': 99}