<br><br><div><span class="gmail_quote">On 5/20/07, <b class="gmail_sendername">Jon Hylands</b> <<a href="mailto:jon@huv.com">jon@huv.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Hi everyone,<br><br>On my current robotics project, I'm using a gumstix verdex to talk over a<br>USB to serial converter chip (FT232) to a serial bus.<br><br>My brother Dave made up a new kernel driver for the gumstix, and when I
<br>plug in the chip it registers itself as ttyUSB0.<br><br>For work I've done previously on Squeak on the gumstix, I've used standard<br>serial ports, which map to ttyS0, ttyS1, ttyS2, etc, which correspond to<br>
port 0, 1, and 2 when I open the Serial Port in Squeak. However, I have no<br>idea which port number ttyUSB0 corresponds to...<br><br>Anyone got any idea?<br><br></blockquote></div><br>I have to scratch this itch :-). This is something I should know but don't.
<br><br>At a guess, I'd say this is your answer, from usb-serial.c in the Linux kernel:<br><br>static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_ports, unsigned int *minor)<br>{<br> unsigned int i, j;
<br> int good_spot;<br><br> dbg("%s %d", __FUNCTION__, num_ports);<br><br> *minor = 0;<br> for (i = 0; i < SERIAL_TTY_MINORS; ++i) {<br> if (serial_table[i])<br> continue;<br><br>
good_spot = 1;<br> for (j = 1; j <= num_ports-1; ++j)<br> if ((i+j >= SERIAL_TTY_MINORS) || (serial_table[i+j])) {<br> good_spot = 0;<br> i += j;<br> break;
<br> }<br> if (good_spot == 0)<br> continue;<br><br> *minor = i;<br> dbg("%s - minor base = %d", __FUNCTION__, *minor);<br> for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i)
<br> serial_table[i] = serial;<br> return serial;<br> }<br> return NULL;<br>}<br><br>I'm assuming that serial_table[] is a list of the ttyUSBn ports, and this just finds a free one starting from ttyUSB0, but somebody smarter than me is going to have to verify this.
<br><br>Also mentioned somewhere is that the device allocation will appear in the system logs. That's a pretty disgusting way to find the device mappings. Another way would be to iterate through the /dev/ttyUSB*'s to find your device which I find equally disgusting. It's probably easiest to simply assume that it is always /dev/ttyUSB0 or /dev/usb/tts/0 if you're using devfs.
<br><br>Did Dave write the code, or did he simply compile it? It sounds like he'd be the person to ask, and I'm surprised he didn't make a /dev/microraptor for you :-).<br><br>Michael.<br>p.s. I've seen a video of your raptor - it rocks!
<br>