How to implement TIOCOUTQ for USB modem on Linux Ubuntu


 
Thread Tools Search this Thread
Operating Systems Linux Ubuntu How to implement TIOCOUTQ for USB modem on Linux Ubuntu
# 8  
Old 06-01-2011
Quote:
Originally Posted by SDoroshenko
Looks like I'd have to ask modem manufacturers if their modems can return how much data are inside modem buffer....
Or read and understand the device driver source code. That's likely to be quite difficult unfortunately.

If these are binary drivers without source code, you're wholly out of luck.
Quote:
usb_submit_urb puts data to HCD (Host Controller Driver). Does HCD put data to device directly, or it transfers data to the next level of Linux kernel?
Transfers it to the USB drivers. USB has its own protocol, etc. quite unrelated to whatever serial buffers the device might have.

What do you need TIOCOUTQ for? Might there be a workaround that doesn't involve bare-metal hardware driver hacking?
# 9  
Old 06-01-2011
Quote:
Originally Posted by Corona688
Or read and understand the device driver source code. That's likely to be quite difficult unfortunately.

If these are binary drivers without source code, you're wholly out of luck.
There are c source of cdc-acm.c, sierra.c, option.c in drivers/usb I was able to recompile (create *.ko files) and use after that.
For example, drivers/usb/class/cdc-acm.c overrides tty method:
741 static int acm_tty_chars_in_buffer(struct tty_struct *tty);

That method supposes to return amount of not sent data.
Unfortunately, it makes those calculations based on amount of urb buffers returned by
505 static void acm_write_bulk(struct urb *urb);
acm_write_bulk seems to return urb buffer after its data were transferred to device, not really sent to destination.


Quote:
Originally Posted by Corona688
What do you need TIOCOUTQ for? Might there be a workaround that doesn't involve bare-metal hardware driver hacking?
For example, I have a USB modem connected to my intel machine and I want to send packets over it with the lowest latency the modem provides.
When network is in good condition the latency (or delay) is lower or about 1 second, which is good.
When network goes weak latency can be huge (even 1 minute).

The idea was:
1) send a packet over sendto()
2) check if packet was sent completely in "short" time.
3a) if it was sent fast enough, my app is happy and continues to send packets over it.
3b) if it wasn't, my app resends that packet over another USB modem and stops using the first modem until it's in good condition again.

If I was able to check if modem is empty I'd be able to implement it.
# 10  
Old 06-01-2011
How about tcdrain()?
This User Gave Thanks to Corona688 For This Post:
# 11  
Old 06-01-2011
I didn't know about tcdrain. Smilie
I will test it tomorrow.

According to man: The tcdrain() function waits until all output written to the terminal referenced by fildes has been transmitted to the terminal.
What is called terminal? is it hardware? if it is it's exactly the same as cdc-acm does currently: it controls urbs going to device and doesn't control if urbs are sent really. Smilie
# 12  
Old 06-02-2011
Linux, perhaps even UNIX in general, considers serial ports and all things pretending to be serial ports, as terminals. (And vice versa!) Consider an old-fashioned hardware serial port with a hardware terminal attached. To transmit the data to the terminal -- that is, display it -- it really would have to transmit it. In other words, it does exactly what it says on the tin. Don't panic. Smilie
# 13  
Old 06-28-2011
Unfortunately, tcdrain didn't help to solve the problem. But actually it's not bad anymore. Nobody says that packets are stuck inside modems. They could be stuck somewhere on providers' routers.
So we decided to implement tricky two-direction protocol to control if modem is working properly. And surprisingly the protocol works so good that we are able to stream 1080p live, which we wanted to.

So thanks for help. I'm really appreciated.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Solaris

How to setup prolink 3.5g hsdpa usb modem in Solaris 11.2?

hi, I am new to solaris, i download the solaris 11.2 support library and as well search the google but didn't find any information about how to setup usb 3g modem in solaris 11.2, any one can please help me with giving any information or web link? (6 Replies)
Discussion started by: shamsat
6 Replies

2. Solaris

Solaris 11.2 does not assign serial port to 3g usb modem?

In ubuntu etopic i create this udev rules for prolink 3g usb modem: SUBSYSTEM=="block", SUBSYSTEM=="scsi", ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="f000", ACTION=="add", RUN+="/sbin/modprobe usbserial Vendor=0X1e0e Product=0Xf000" After plugging the usb modem, ubuntu assigns the ports... (4 Replies)
Discussion started by: shamsat
4 Replies

3. UNIX for Dummies Questions & Answers

USB-USB cable between linux and windows computers

Is there an easy way to setup a cross-over cable (USB-USB) between a linux box and a windows PC? My 2 machines are next to each other but I really do not want to keep transfering my files using my USB drive. Thanks! (4 Replies)
Discussion started by: Xterra
4 Replies

4. Solaris

Installing USB adsl modem?

Hello all, granted that I am an absolute beginner with Solaris, I'd like to use my adsl modem, t's a Zyxel prestige 630. I managed to install and configure it under Ubuntu using the drivers from Conexant AccessRunner ADSL USB modems with Linux ; is there a chance to do the same under Solaris 10... (0 Replies)
Discussion started by: clalfa
0 Replies

5. Linux

modem - usb to serial configuration

I have a serial modem connected to a usb port using an adapter cable. The system is a HP DL360. RedHat ES3.0 I am using the device /dev/ttyUSB0 When I issue the command "mgetty ttyUSB0" I get the following output in the log file. How do I get the system to see the modem. 12/02 14:17:55... (2 Replies)
Discussion started by: jshoovie
2 Replies

6. Solaris

Solaris 9 & USR USB Modem Configuration

Hello There, I just wanted to know if there is any possible configuration for setting up my external USR USB Modem in Solaris 9 (x86). Any help is definitely appreciated. Thanks Khurram Bashir (1 Reply)
Discussion started by: khurram
1 Replies

7. Solaris

Solaris 10 ADSL USB modem problem

Hi, I have USB Siemens Santis 100 ADSL modem.I need driver for this modem on Solaris 10.Please help me with some info.Platform is x86.Thanks. (2 Replies)
Discussion started by: Upravnik
2 Replies

8. UNIX for Dummies Questions & Answers

Add usb modem on a 5.0.7

hi guys i know a litter bit of sco openserver 5.0.6 I got my self a 5.0.7 version. The problem is how do you install a usb modem? The way i'm used to doit is by serial port , you know tty1A . Please guys bear with me Thanks a lot Jose. (1 Reply)
Discussion started by: josramon
1 Replies
Login or Register to Ask a Question