On 2/1/07, <b class="gmail_sendername">Jon Gough</b> &lt;<a href="mailto:jon.gough@eclipsesystems.com.au">jon.gough@eclipsesystems.com.au</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div>
<font size="3">Carlos,<br>
&nbsp;&nbsp; I am using Serial-Over-USB to drive my UPS. I have taken the
work that was done for the AGILER interface and added the ABLEREX
interface. However, I could not get the &#39;get_interrupt&#39; command to work.
It would not return any useful data. So I had to change the &#39;set_data
code&#39; to issue &#39;usb_get_string_simple&#39; and translate the character
requests into index numbers. The &#39;get_data&#39; just reads a static variable
that is set by the &#39;set_data&#39;. In this way I can get most of the
functionality working.<br><br>
&nbsp;&nbsp; However, I cannot pass &#39;data&#39; to the UPS as I am issuing
numeric commands, ie:<br><br>
&nbsp;&nbsp; if (strcmp(str, &quot;Q1\r&amp;quot
<img alt="Winking smiley" height="19" width="19"> == 0)<br>
&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; upsdebugx(4, &quot;set_data_ablerex: Doing
Q1 stuff&amp;quot
<img alt="Winking smiley" height="19" width="19">;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rc = usb_get_string_simple(udev, 3,
report_buf, sizeof(report_buf));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get_done = TRUE;<br>
&nbsp;&nbsp; }<br><br>
I would like to find out how to pass the longer commands with variable
parameter data to the UPS.</font></div></blockquote><div><br><br>Ok, I see.<br><br>Then the current status is...<br><br>We now have three variants for megatec transport:<br><br>&nbsp; 1) megatec over RS-232<br>&nbsp; 2) megatec over USB in a simple send/receive string fashion
<br>&nbsp; 3) megatec mapped to USB specific stuff<br></div><br>The idea is to keep megatec unmodified, and up until now a simple USB communications layer with the same API as the serial layer would make this possible. The only catch was the need to add &quot;subdrivers&quot; to support different models, but otherwise this layer could even prove useful for protocols other than megatec.
<br><br>The original agiler interface by Andrey Lelikov modifies &quot;megatec.c&quot; to add that USB layer, but I think it should be just an outside file with the same API as the serial layer, and linked at compile time to generate an ablerex specific driver, even if it is megatec specific.
<br><br>Then 1) would be &quot;serial.c&quot;, 2) &quot;megatec-transport-usb.c&quot;, 3) &quot;megatec-transport-ablerec.c&quot;<br><br>But don&#39;t worry about that just now. It is more important to see it working, this refactoring can be done later.
<br><br>When I have some free time I&#39;ll check which one of these transport mechanisms my own UPS uses. Then I&#39;ll be able to help in refactoring whatever code we have by that time.<br><br><br></div><font size="3">&gt; Anyway. I think you should go to bed! 4am is for sleeping not coding!
Here in Australia it is only 15:10, (or 04:10<br>&gt; UTC, which of course you
already know!).<br></font><br><br>I&#39;m something of a night creature. But with work and studying for pending exams a 24 hour day is just too short. :)<br><br><br>-- <br>Carlos Rodrigues