I went through usb-serial.c
, which is a source file in the usbserial
module in the Linux kernel. I would like to implement some customization in this driver, e.g., blinking LED when a communication (Tx/Rx) happens. However, I am having trouble finding the functions which are responsible for that communication. I was able to find serial_write
but was not able to find a serial_read
, serial_receive
, or similar. Does anyone know about the receive data function in this driver? Thanks in advance..!
Asked
Active
Viewed 185 times
1
1 Answers
1
Try usb_serial_generic_read_bulk_callback
(from drivers/usb/serial/generic.c). I think the line in this function that has port->read_urbs
is basically when the USB read is starting from.
So if you make your own version of that function you can put it in usb_serial_operations_init
in place of usb_serial_generic_read_bulk_callback

Secto Kia
- 990
- 4
- 12
-
you mean read_bulk_callback and write_bulk_callback is for rx/tx – md.jamal Sep 10 '18 at 13:42
-
Yes, I was probably looking at wrong thing. in read_balk_callback function the line usb_submit_urb is what is doing the USB read, basically the urb is a USB transaction that is setup (at usb_fill_bulk_urb) and then submitted for execute (at sub_submit_urb) – Secto Kia Sep 10 '18 at 14:05