Giter Club home page Giter Club logo

Comments (1)

xxlvoyager avatar xxlvoyager commented on August 17, 2024

#Rewrite connector_usbhid.py
import os
from connector import (Connector)
from time import sleep

class USBConnector(Connector):

def write(self, data):    
    os.write (self.fd, data)
    sleep(0.45)

def read(self, size):
    retry=0
    return self._read(size)

def _read(self, size):
    data = ''
    while True:
        sleep(0.17)
        data += ''.join(map(chr, os.read (self.fd,size)))
        if not data or '\r' in data or len(data) >= size:
            break
    return data


def open(self):
    try:
        self.fd = os.open('/dev/hidraw0', os.O_RDWR | os.O_NONBLOCK)
        sleep(0.35)
    except Exception as e:
        self.log.error(e)

    
def close(self):        
    os.close(self.fd)

from godenerg.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.