Posts

Showing posts from May, 2020

USB linux Part 2

Hello Fellas, We have succeeded in making the kernel and detecting devices that we will use, then we make an interface so that the program that we make can interact with the kernel and from the kernel can be sent to the hardware. if we inspect the code we will find some code copy_to_user (buffer, dev -> bulk_in_buffer + dev -> bulk_in_copied , chunk) Thats will show you how the kernel will send the data to user with copy_to_user function. Maybe before we jump into kernel userspace we need to read the documentation about user space using linux you can read here .

USB for LINUX part 1

Image
Today i start usb development using linux/usbdevice_fs.h, maybe it will be easy to use usb.h, but its better to use linux/usbdevice_fs.h to make some development in usb linux driver. Yes, you know that linux/usbdevice_fs.h is linux kernel API. Some reason that i will not usb.h from libusb that it not base from linux so if i would make driver maybe better using ioctl api to get access from user perspective. On reference 2 some error detected that issue summoning because asm/uaccses not found in this code. On reference 3 give better explained from usb using kernel. This how you must read. If you wanna read reference 4 you will know how the usb driver written, reference 4 provide example code. There are some failure like detecting device on refences 4. if you get some reference you will get some header you will need #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> /* kmalloc() */ #include <linux/usb.h> /* USB stuff */ #include <