Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest linux kernel #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 17 additions & 22 deletions Linux/cp210x/build_install.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
import tarfile
from StringIO import StringIO
from io import BytesIO

def main():
installScript = open("install.sh.in").read()
payloadStart = len(installScript.splitlines()) + 1
#payloadStart = len(installScript) - 1 + len(str(len(installScript)))
#if len(installScript) - 1 + len(str(payloadStart)) != payloadStart:
# payloadStart += 1

print "payloadstart=%s" % payloadStart
installScript = installScript.replace("payloadstart=0", "payloadstart=%s" % payloadStart)
with open("install.sh.in", "r") as f:
installScript = f.read()
payloadStart = len(installScript.splitlines()) + 1

output = open("install.sh", 'wb')

tarData = StringIO()
tarFile = tarfile.open(fileobj=tarData, mode='w:bz2')
tarFile.add("cp210x.c")
tarFile.add("Makefile")
tarFile.add("dkms.conf")
tarFile.close()
print(f"payloadstart={payloadStart}")
installScript = installScript.replace("payloadstart=0", f"payloadstart={payloadStart}")

with open("install.sh", 'wb') as output:
tarData = BytesIO()
with tarfile.open(fileobj=tarData, mode='w:bz2') as tarFile:
tarFile.add("cp210x.c")
tarFile.add("Makefile")
tarFile.add("dkms.conf")

output.write(installScript.encode())
output.write(tarData.getvalue())

output.write(installScript)
output.write(tarData.getvalue())
output.close()

if __name__ == "__main__":
main()
main()
6 changes: 2 additions & 4 deletions Linux/cp210x/cp210x.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port,
unsigned int, unsigned int);
static void cp210x_break_ctl(struct tty_struct *, int);
static int cp210x_port_probe(struct usb_serial_port *);
static int cp210x_port_remove(struct usb_serial_port *);
static void cp210x_port_remove(struct usb_serial_port *);
static void cp210x_dtr_rts(struct usb_serial_port *p, int on);

static const struct usb_device_id id_table[] = {
Expand Down Expand Up @@ -1375,14 +1375,12 @@ static int cp210x_port_probe(struct usb_serial_port *port)
return 0;
}

static int cp210x_port_remove(struct usb_serial_port *port)
static void cp210x_port_remove(struct usb_serial_port *port)
{
struct cp210x_port_private *port_priv;

port_priv = usb_get_serial_port_data(port);
kfree(port_priv);

return 0;
}

module_usb_serial_driver(serial_drivers, id_table);
Expand Down