krinkinmu / bootlin Goto Github PK
View Code? Open in Web Editor NEWCode for the materials from the Bootlin (http://bootlin.com) kernel course and https://krinkinmu.github.io/
Code for the materials from the Bootlin (http://bootlin.com) kernel course and https://krinkinmu.github.io/
Hello, first let me say thank you! I really realy enjoyed reading your ftdi reverse breakdown. I am in awe and jealous of your skills. So i too your kernel driver, my first attempt it didnt work failed the check in probe. I immediately went to sniffing a working userland tool (should have tried more with stock code) and found a fair amount of differences, here ill list sum;
const u16 FTDI_BIT_MODE_RESET = 0x00ff;
const u16 FTDI_BIT_MODE_MPSSE = 0x02ff;
ret = usb_control_msg(
ftdi->udev, usb_sndctrlpipe(ftdi->udev, 0),
/* bRequest = */0x00,
/* bRequestType = */0x40,
/* wValue = */0x0000,
/* wIndex = */0x0000,
/* data = */NULL,
/* size = */0,
ftdi->io_timeout);
if (ret < 0)
return ret;
ret = usb_control_msg(
ftdi->udev, usb_sndctrlpipe(ftdi->udev, 0),
/* bRequest = */0x03,
/* bRequestType = */0x40,
/* wValue = */0x4138,
/* wIndex = */0x0001,
/* data = */NULL,
/* size = */0,
ftdi->io_timeout);
if (ret < 0)
return ret;
ret = usb_control_msg(
ftdi->udev, usb_sndctrlpipe(ftdi->udev, 0),
/* bRequest = */0x00,
/* bRequestType = */0x40,
/* wValue = */0x0000,
/* wIndex = */0x0001,
/* data = */NULL,
/* size = */0,
ftdi->io_timeout);
if (ret < 0)
return ret;
ret = usb_control_msg(
ftdi->udev, usb_sndctrlpipe(ftdi->udev, 0),
/* bRequest = */0x00,
/* bRequestType = */0x40,
/* wValue = */0x0001,
/* wIndex = */0x0001,
/* data = */NULL,
/* size = */0,
ftdi->io_timeout);
if (ret < 0)
return ret;
ret = usb_control_msg(
ftdi->udev, usb_sndctrlpipe(ftdi->udev, 0),
/* bRequest = */0x00,
/* bRequestType = */0x40,
/* wValue = */0x0002,
/* wIndex = */0x0001,
/* data = */NULL,
/* size = */0,
ftdi->io_timeout);
if (ret < 0)
return ret;
As you can see I had to change the RESET, MPSSE and wIindex also added a baudrate change (I dunno either), and still had to remove the check ftdi_mpsse_verify. I then added smbus support and blocked binding to bank B (Im using ft2232h) and everything is working great! Will add kernel mods for speed and bank A/B options and /sys entries for changing speed etc as well when I find time. I realize you probly already know but in case someone stumbles here;
PURGE RX AND TX BUFFERS
/* bRequest = */0x00,
/* bRequestType = */0x40,
/* wValue = */0x0000,
/* wIndex = */0x0001,
/* data = */NULL,
/* size = */0,
PURGE RX BUFFERS
/* bRequest = */0x00,
/* bRequestType = */0x40,
/* wValue = */0x0001,
/* wIndex = */0x0001,
/* data = */NULL,
/* size = */0,
PURGE TX BUFFERS
/* bRequest = */0x00,
/* bRequestType = */0x40,
/* wValue = */0x0002,
/* wIndex = */0x0001,
/* data = */NULL,
/* size = */0,
Ialso get extra 2 bytes on invalid/bad commands i guess an error code. My versions is located here;
https://github.com/bm16ton/ft2232-mpsse-i2c-spi-kern-drivers
and integrated into my kernel here;
https://github.com/bm16ton/yoga-c630-linux-kernel
with hopefully more updates coming soon. Is there any reason this couldnt be submitted for mainline kernel? Again great work and thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.